pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Віталій Тимчишин <tivv00@gmail.com>
To: Matthew Wakeling <matthew@flymine.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: Very specialised query
Date: Mon, 30 Mar 2009 21:13:23 +0300
Message-ID: <331e40660903301113x7371fb33n302fc3f2c720efb2@mail.gmail.com> (raw )
In-Reply-To: <alpine.DEB.2.00.0903301719230.21772@aragorn.flymine.org >
References: <alpine.DEB.2.00.0903261313290.21772@aragorn.flymine.org >
<331e40660903270936u5db00807sb1169df66443ade3@mail.gmail.com >
<alpine.DEB.2.00.0903271708080.21772@aragorn.flymine.org >
<2298.1238179393@sss.pgh.pa.us >
<alpine.DEB.2.00.0903301618190.21772@aragorn.flymine.org >
<331e40660903300914x1c7747d0j94be7addeb2b31f5@mail.gmail.com >
<alpine.DEB.2.00.0903301719230.21772@aragorn.flymine.org >
>
>
> Yeah, that's nice.
>
> However, it is still the case that we can't trust the database to choose
> the correct plan. It is currently only choosing the correct plan now by
> chance, and some time later it may by chance switch to one that takes 40
> minutes.
What is the bad plan? Is it like the first plan from your first message?
You can sometimes tweak optimizer to make sure it will do correct plan. E.g.
when your database fits in memory, you can tweak page access costs. Also
don't forget to raise statistics target.
BTW: About aggregates: they can return arrays, but I can't imagine what you
can group by on... May be windowing functions from 8.4 could help.
Also, if your maximum length (select max(end-start) from location) is low
enough, you can try adding some more constraints to make optimizer happy
(have it more precise row count to select correct plan).
view thread (29+ messages) latest in thread
Message-ID: <331e40660903301113x7371fb33n302fc3f2c720efb2@mail.gmail.com>
Permalink: ../331e40660903301113x7371fb33n302fc3f2c720efb2@mail.gmail.com/
Also on: postgresql.org/message-id/331e40660903301113x7371fb33n302fc3f2c720efb2@mail.gmail.com
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tivv00@gmail.com, matthew@flymine.org
Subject: Re: Very specialised query
In-Reply-To: <331e40660903301113x7371fb33n302fc3f2c720efb2@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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