Re: Measuring execution time

From: Mark Kirkwood <mark(dot)kirkwood(at)catalyst(dot)net(dot)nz>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Measuring execution time
Date: 2010-08-11 02:55:35
Message-ID: 4C621127.8010300@catalyst.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 11/08/10 14:42, Mark Kirkwood wrote:
> On 10/08/10 19:46, vamsi krishna wrote:
>> Hello all
>> I want to measure the execution time spent running an SQL select
>> query after the plan generation.
>> So precisely I want to put my start timer before createQueryDesc() or
>> ExecutorStart() and end timer after freeQueryDesc() or ExecutorEnd().
>> Right now I did so in "spi.c", "explain.c", "pquery.c" but they are
>> not the default execution cases. Can someone tell me which file holds
>> the default call to ExecutorStart(), because I also want to see the
>> select query result unlike in the case of "explain" ?
>>
>
> See ProcessQuery in src/backend/tcop/query.c

Doh - sorry, I see you have that guy! Have a look at exec_simple_query
in src/backend/tcop/postgres.c, by the time pg_plan_queries returns you
have finished planning. The call to CreateQueryDesc is going to be from
PortalStart in that case. Hopefully this will get you started (you may
need to look at exec_*_message functions too).

Mark

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Ramachandran S 2010-08-11 09:36:31 BUG #5612: Database Integrity
Previous Message Tom Lane 2010-08-11 02:55:21 Re: BUG #5611: SQL Function STABLE promoting to VOLATILE

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-08-11 03:39:55 Re: review: psql: edit function, show function commands patch
Previous Message Mark Kirkwood 2010-08-11 02:42:40 Re: Measuring execution time