Hi, On Mon, Jun 27, 2011 at 4:05 PM, hubert depesz lubaczewski <[email protected]> wrote: >> I checked DB logs, and the only thing I noticed was that I had calls to this >> query: > > I had enabled only logging queries over 50ms. > > When I enabled logging every query that hits database the situation > changed a lot. > > Single request to /Ticket/Display.html?id=17583 > where the ticket has 3 attachements and no comments besides original > creation caused rt to issue 6735 queries (some of these are triplets: > parse/bind/execute, but even 2000 is A LOT for a single page.
Actually it's 1710 queries: cat statement.log | grep 'statement:\|execute ' | grep -v 'DEALLOCATE' | wc -l 1710 1617 of which follow the following pattern: SELECT consrc FROM pg_catalog.pg_constraint WHERE contype = 'c' AND conrelid = ... These queries are sequential. As far as I can see from the log this sequence triggered by DBD::Pg to get information about tables in the DB. I believe we cache this info and it only requested once per process. If it's not the case then it's bug. > Total runtime of the queries is ~ 400ms, which doesn't explain 4.402s > page generation time, but perhaps it could help debug the problem? 278ms taken by the sequence. > Full log is accessible at http://depesz.com/various/statement.log.gz > > Is it something that I did wrong with RT? Next step is to use Mason profiler. > Best regards, > > depesz > > > -------- > 2011 Training: http://bestpractical.com/services/training.html > -- Best regards, Ruslan. -------- 2011 Training: http://bestpractical.com/services/training.html
