Re: detecting poor query plans - Mailing list pgsql-hackers

From Greg Stark
Subject Re: detecting poor query plans
Date
Msg-id 877k1nxg2b.fsf@stark.dyndns.tv
Whole thread Raw
In response to detecting poor query plans  (Neil Conway <neilc@samurai.com>)
Responses Re: detecting poor query plans
List pgsql-hackers
Neil Conway <neilc@samurai.com> writes:

> It occurred to me that these kinds of poor planning decisions could easily
> be detected by PostgreSQL itself: after we've finished executing a plan, we
> can trivially compare the # of results produced by each node in the query
> tree with the # of results the planner expected that node to produce

There's a dual to this as well. If the results were very close but the actual
time taken to run the node doesn't match the cost calculated then some
optimizer parameter needs to be adjusted. Either one of the cost_* parameters
or random_page_cost, or effective_cache_size or...

I'm not sure it's as obvious what to put in the HINT though. Ideally these
results would have to be gathered and pumped through linear optimization
algorithms which is a lot more work.

-- 
greg



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Providing anonymous mmap as an option of sharing memory
Next
From: Tom Lane
Date:
Subject: Re: pg_restore and create FK without verification check