From: Robert Haas <robertmhaas@gmail.com>
To: Bryce Nesbitt <bryce2@obviously.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: 512,600ms query becomes 7500ms... but why? Postgres 8.3 query planner quirk?
Date: Mon, 15 Feb 2010 11:41:43 -0500
Message-ID: <603c8f071002150841w53cda2f6l7901e7af06da862@mail.gmail.com> (raw)
In-Reply-To: <4B765B94.4000602@obviously.com>
References: <4B723042.7090406@obviously.com>
<4B751AD5020000250002F248@gw.wicourts.gov>
<4B757C59.8070500@denninger.net>
<4B752934020000250002F24E@gw.wicourts.gov>
<4B75851E.6070909@denninger.net>
<26772.1266005254@sss.pgh.pa.us>
<4B765B94.4000602@obviously.com>
On Sat, Feb 13, 2010 at 2:58 AM, Bryce Nesbitt <bryce2@obviously.com> wrote:
> So as the op, back to the original posting....
>
> In the real world, what should I do? Does it make sense to pull the "AND
> articles.indexed" clause into an outer query? Will that query simply
> perform poorly on other arbitrary combinations of words?
It's really hard to say whether a query that performs better is going
to always perform better on every combination of words. My suggestion
is - try it and see. It's my experience that rewriting queries is a
pretty effective way of speeding them up, but I can't vouch for what
will happen in your particular case. It's depressing to see that
increasing the statistics target didn't help much; but that makes me
think that the problem is that your join selectivity estimates are
off, as Tom and Jorge said upthread. Rewriting the query or trying an
upgrade are probably your only options.
...Robert
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: robertmhaas@gmail.com, bryce2@obviously.com
Subject: Re: 512,600ms query becomes 7500ms... but why? Postgres 8.3 query planner quirk?
In-Reply-To: <603c8f071002150841w53cda2f6l7901e7af06da862@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