开发者

Count number of queries performed by Doctrine

I am using Doctrine and sometimes I've the feeling that it is doing much more things than what I am expecting, so I 开发者_运维技巧would like to have more information (and therefore more control) about what Doctrine is doing.

So, how I could count the total number of queries that Doctrine is doing?. It would be nice if I could also find the SQL statements that Doctrine is performing implicitly, (apart of the ones that I am creating).

Thank you in advance!


I suggest this wonderful article:

http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-8-hooks-profiling-dql

Find the section that's headed "Profiling with Doctrine" This is specific for the use with a framework but you should figure out how to do it without the framework, it's not hard


Doctrine has a Profiler components, that allows one to keep track of every access that's done to the database.

See : Profiler


Note, though, that the profiler could get you much more informations that you expect : depending on how you configure it, it'll indicate each time some data is fetched from the DB as an event (even if it doesn't mean a query is performed each time).

Also; as Doctrine is using prepared statements, you'll never be able to see any "real" SQL query : you'll only see statements, and the corresponding data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜