Re: Cached Query Plans (was: global prepared statements) - Mailing list pgsql-hackers

From Jonah H. Harris
Subject Re: Cached Query Plans (was: global prepared statements)
Date
Msg-id 36e682920804121842n178275abg41316c3992bed218@mail.gmail.com
Whole thread Raw
In response to Re: Cached Query Plans (was: global prepared statements)  ("Dawid Kuroczko" <qnex42@gmail.com>)
Responses Re: Cached Query Plans (was: global prepared statements)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sat, Apr 12, 2008 at 2:19 PM, Dawid Kuroczko <qnex42@gmail.com> wrote:
>  There are other benefits as well.  Oracle lets you see the statistics associated
>  with given plans.  So you can see how many times given (cached) query was
>  executed, how much resources did it consume and do on.

Yes, and it also uses that data at both the statement and column level
to determine what needs more analysis to help build better plans in
the future.

>  Right now the only way of getting such information from PostgreSQL is by
>  logging all queries and analyzing logs.  The current_query column of
>  pg_stat_activity is useless as the (prepared) queries are usually so short
>  lived that you will see one execution out of thousands happening.

Yes, this is worthless on large active databases.  The logging
overhead alone starts to affect performance.

>  Nooow, suppose we do have cached plans.  Then we can have a view
>  pg_stat_queries + a stats collector which will track number of executions,
>  number of blocks hit, blocks read, etc.  Would be great! :)

With the exception that the stats collector itself needs a bit of work
to handle larger volumes of statistics, I agree.

-- 
Jonah H. Harris, Sr. Software Architect | phone: 732.331.1324
EnterpriseDB Corporation | fax: 732.331.1301
499 Thornall Street, 2nd Floor | jonah.harris@enterprisedb.com
Edison, NJ 08837 | http://www.enterprisedb.com/


pgsql-hackers by date:

Previous
From: "Jonah H. Harris"
Date:
Subject: Re: Cached Query Plans (was: global prepared statements)
Next
From: Tom Lane
Date:
Subject: Re: Cached Query Plans (was: global prepared statements)