Issues with storage of data in stack

Mark Talluto mark at
Thu Mar 8 13:38:13 EST 2018

> On Mar 8, 2018, at 9:03 AM, Lagi Pittas via use-livecode <use-livecode at> wrote:
> In the first version of the system I save the arrays which held all
> the Clerks orders/totals etc and items into an external stack every
> time they added an item.

I too use arrays as a data store. You could save the arrays to disk directly with arrayEncode(). To save time and not store the entire array to disk, you could store only the portions that have been updated on every update. This will keep the data store safe and fast. It will also remove the occasional issue of stack corruption…since you will not store the data inside of stacks any longer.

All creates/reads/update/writes would be done to memory. Those calls that modify data will simply do a follow-up write to disk for that particular record. To defeat OS inode limitations, you could group your arrays logically into files. Thus, you would have anywhere from 1 to a 100 sub arrays grouped together. The loading and storing of arrays is very fast. Even with databases in the 100s of thousands to low millions of records counts. 

Performance is amazing. The best part is you are speaking to your database using LiveCode commands and functions. The only limitation is the amount of RAM on a given device. Should you outgrow that limitation then you could move the data to the cloud. Or you could load/unload data accordingly from disk. This would also be a nice indicator that your business is growing. Of course, it could just be that you are storing a lot of data. :)

If you need any help or ideas, let me know.

Best regards,

Mark Talluto <> <> <>

More information about the Use-livecode mailing list