We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Which is better for storing temporary data (size is variable )among "persistent","memcached","temporary sql table"?

Which is better for storing temporary data (size is variable )among "persistent","memcached","temporary sql table"?

It depends - how many times it will be access, will you need it always etc. I would just go with memcached most likely.

SQL table - for sure NO. Persistent data should be the fastest by definition as it resides in the same application scope/runtime/shared memory space. And Memcached memory daemon is the best for handling large amounts or concurrent data.

SQL table here means in_memory Table

Still, MEMORY MySQL/MariaDB engine can be even slower for concurent usage (both reads and writes) than plain MyISAM.



9.7k

The speed of a database is determined by the memory available to cache indexes and everything else. You can get real performance problems from limited memory or memory settings that no longer match the data in use. Memcache is a separate configuration, easy to set, and usually reliable unless you configure so much memory that you make the system page everything out.

On my test system, a file cache is almost as fast because Linux has enough memory to cache all the file information.