pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedDrop statistics?
5+ messages / 3 participants
[nested] [flat]
* Drop statistics?
@ 2012-06-22 17:07 David Kerr <dmk@mr-paradox.net>
0 siblings, 1 reply; 5+ messages in thread
From: David Kerr @ 2012-06-22 17:07 UTC (permalink / raw)
To: pgsql-performance
I'm trying to work through a root cause on a performance problem. I'd like to
be able to "show" that a problem was fixed by analyzing the table.
what i've done is
set default_statistics_target=1
analyze <Table>
That gets rid of most of the rows in pg_stats, but i'm still getting decent performance.
It's possible that the existing stats were just not optimal, and i won't be able to get that back.
But I just want to verify that what i've done is the only real option that I have? am i missing anything
else that I could try?
(I'm on PG9.1)
Thanks.
Dave
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Drop statistics?
@ 2012-06-22 17:27 Tom Lane <tgl@sss.pgh.pa.us>
parent: David Kerr <dmk@mr-paradox.net>
0 siblings, 1 reply; 5+ messages in thread
From: Tom Lane @ 2012-06-22 17:27 UTC (permalink / raw)
To: David Kerr <dmk@mr-paradox.net>; +Cc: pgsql-performance
David Kerr <dmk@mr-paradox.net> writes:
> I'm trying to work through a root cause on a performance problem. I'd like to
> be able to "show" that a problem was fixed by analyzing the table.
> what i've done is
> set default_statistics_target=1
> analyze <Table>
> That gets rid of most of the rows in pg_stats, but i'm still getting decent performance.
I usually do something like
DELETE FROM pg_statistic WHERE starelid = 'foo'::regclass;
(you need to be superuser to be allowed to do this).
You may need to keep an eye on whether auto-analyze is coming along and
undoing what you did, too.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Drop statistics?
@ 2012-06-22 18:04 David Kerr <dmk@mr-paradox.net>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 5+ messages in thread
From: David Kerr @ 2012-06-22 18:04 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-performance
On Fri, Jun 22, 2012 at 01:27:51PM -0400, Tom Lane wrote:
- David Kerr <dmk@mr-paradox.net> writes:
- > I'm trying to work through a root cause on a performance problem. I'd like to
- > be able to "show" that a problem was fixed by analyzing the table.
-
- > what i've done is
- > set default_statistics_target=1
- > analyze <Table>
-
- > That gets rid of most of the rows in pg_stats, but i'm still getting decent performance.
-
- I usually do something like
-
- DELETE FROM pg_statistic WHERE starelid = 'foo'::regclass;
-
- (you need to be superuser to be allowed to do this).
-
- You may need to keep an eye on whether auto-analyze is coming along and
- undoing what you did, too.
-
- regards, tom lane
-
Awesome, thanks!
Dave
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Drop statistics?
@ 2012-07-03 17:16 Bruce Momjian <bruce@momjian.us>
parent: David Kerr <dmk@mr-paradox.net>
0 siblings, 1 reply; 5+ messages in thread
From: Bruce Momjian @ 2012-07-03 17:16 UTC (permalink / raw)
To: David Kerr <dmk@mr-paradox.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-performance
On Fri, Jun 22, 2012 at 11:04:36AM -0700, David Kerr wrote:
> On Fri, Jun 22, 2012 at 01:27:51PM -0400, Tom Lane wrote:
> - David Kerr <dmk@mr-paradox.net> writes:
> - > I'm trying to work through a root cause on a performance problem. I'd like to
> - > be able to "show" that a problem was fixed by analyzing the table.
> -
> - > what i've done is
> - > set default_statistics_target=1
> - > analyze <Table>
> -
> - > That gets rid of most of the rows in pg_stats, but i'm still getting decent performance.
> -
> - I usually do something like
> -
> - DELETE FROM pg_statistic WHERE starelid = 'foo'::regclass;
> -
> - (you need to be superuser to be allowed to do this).
> -
> - You may need to keep an eye on whether auto-analyze is coming along and
> - undoing what you did, too.
> -
> - regards, tom lane
> -
>
> Awesome, thanks!
One cool trick I have seen is to do the DELETE pg_statistic in a multi-statement
transaction and then run query query, and roll it back. This allows the
statistics to be preserved, and for only your query to see empty
pg_statistic values for the table.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Drop statistics?
@ 2012-07-05 05:53 David Kerr <dmk@mr-paradox.net>
parent: Bruce Momjian <bruce@momjian.us>
0 siblings, 0 replies; 5+ messages in thread
From: David Kerr @ 2012-07-05 05:53 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-performance
On Jul 3, 2012, at 10:16 AM, Bruce Momjian wrote:
> On Fri, Jun 22, 2012 at 11:04:36AM -0700, David Kerr wrote:
>> On Fri, Jun 22, 2012 at 01:27:51PM -0400, Tom Lane wrote:
>> - David Kerr <dmk@mr-paradox.net> writes:
>> - > I'm trying to work through a root cause on a performance problem. I'd like to
>> - > be able to "show" that a problem was fixed by analyzing the table.
>> -
>> - > what i've done is
>> - > set default_statistics_target=1
>> - > analyze <Table>
>> -
>> - > That gets rid of most of the rows in pg_stats, but i'm still getting decent performance.
>> -
>> - I usually do something like
>> -
>> - DELETE FROM pg_statistic WHERE starelid = 'foo'::regclass;
>> -
>> - (you need to be superuser to be allowed to do this).
>> -
>> - You may need to keep an eye on whether auto-analyze is coming along and
>> - undoing what you did, too.
>> -
>> - regards, tom lane
>> -
>>
>> Awesome, thanks!
>
> One cool trick I have seen is to do the DELETE pg_statistic in a multi-statement
> transaction and then run query query, and roll it back. This allows the
> statistics to be preserved, and for only your query to see empty
> pg_statistic values for the table.
>
Nice! thanks!
Dave
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2012-07-05 05:53 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-06-22 17:07 Drop statistics? David Kerr <dmk@mr-paradox.net>
2012-06-22 17:27 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-06-22 18:04 ` David Kerr <dmk@mr-paradox.net>
2012-07-03 17:16 ` Bruce Momjian <bruce@momjian.us>
2012-07-05 05:53 ` David Kerr <dmk@mr-paradox.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox