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

Database INFORMATION_SCHEMA

Hi guys!

I've turned on profiling for my DB queries and one thing I'm seeing is something like SELECT IF(COUNT(*)>0, 1 , 0) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='xxx'

I'm wondering if that can be cached or avoided somehow? There's no point in executing this query every time I need to do something with a table...

I have to admit I didn't go through all of the documentation so I'm sorry if this is already written somewhere.



1.1k

I was a bit too hasty. Here's how you do that:

$di->set('modelsMetadata', function() { // Create a meta-data manager with APC $metaData = new \Phalcon\Mvc\Model\MetaData\Apc(array( "lifetime" => 86400, "prefix" => "my-prefix" )); return $metaData; });



5.1k

Running processes from command line will still run those queries for each thread of the script you run, each time it runs. I am trying to find a way to avoid that.