From: Jeff Cole <cole.jeff@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re:
Date: Thu, 8 Mar 2007 10:30:03 -0500
Message-ID: <1DD346B1-B8FF-4A0A-950F-A8976B85B78C@gmail.com> (raw)
In-Reply-To: <19988.1173285440@sss.pgh.pa.us>
References: <9BAE31C9-93A6-48AE-AFED-3BB1947D13F1@gmail.com>
<25081.1173146092@sss.pgh.pa.us>
<43756010-6EF6-4F91-B84E-E7D29599C3E8@gmail.com>
<5644.1173199253@sss.pgh.pa.us>
<3FB60C33-F8C7-4E6C-A02C-1D15605C4E96@gmail.com>
<19988.1173285440@sss.pgh.pa.us>
Hi Tom, thanks for the great job getting to the core of this
problem... I would say I'm not sure I want randomize the rows (not
really even sure how to do it without truncating the table and re-
adding the records in a random order). I think for the moment I
will either a) re-write the query per Ismo's suggestion, or b) wait
until more data comes into that table, potentially kicking the query
planner into not using the Nested Loop anymore.
Anyway, thanks again, I appreciate it...
-Jeff
On Mar 7, 2007, at 11:37 AM, Tom Lane wrote:
> Jeff Cole <cole.jeff@gmail.com> writes:
>> Hi Tom, you are correct, the distribution is uneven... In the 13k
>> symptom_reports rows, there are 105 distinct symptom_ids. But the
>> first 8k symptom_reports rows only have 10 distinct symptom_ids.
>> Could this cause the problem and would there be anything I could do
>> to address it?
>
> Ah-hah, yeah, that explains it. Is it worth your time to deliberately
> randomize the order of the rows in symptom_reports? It wasn't clear
> whether this query is actually something you need to optimize. You
> might have other queries that benefit from the rows being in nonrandom
> order, so I'm not entirely sure that this is a good thing to do ...
>
> regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: cole.jeff@gmail.com
Subject: Re:
In-Reply-To: <1DD346B1-B8FF-4A0A-950F-A8976B85B78C@gmail.com>
References: <9BAE31C9-93A6-48AE-AFED-3BB1947D13F1@gmail.com> <25081.1173146092@sss.pgh.pa.us> <43756010-6EF6-4F91-B84E-E7D29599C3E8@gmail.com> <5644.1173199253@sss.pgh.pa.us> <3FB60C33-F8C7-4E6C-A02C-1D15605C4E96@gmail.com> <19988.1173285440@sss.pgh.pa.us> <1DD346B1-B8FF-4A0A-950F-A8976B85B78C@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