From: Lawrence Cohan <LCohan@web.com>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: Postgres not using indexes
Date: Wed, 30 Mar 2011 14:32:14 -0400
Message-ID: <965AA5440EAC094E9F722519E285ACEDAC5E66A55F@WWCEXCHANGE.web.web.com> (raw)
In-Reply-To: <4D9322E8020000250003BF8C@gw.wicourts.gov>
References: <965AA5440EAC094E9F722519E285ACEDAC5E66A53D@WWCEXCHANGE.web.web.com>
<4D9317D3020000250003BF7B@gw.wicourts.gov>
<965AA5440EAC094E9F722519E285ACEDAC5E66A556@WWCEXCHANGE.web.web.com>
<4D9322E8020000250003BF8C@gw.wicourts.gov>
Please see updated attachment that includes the tables involved in the simple query below and all their indexes. We believe that the performance issue is due to the query not using any index but doing seq scans instead and this is very little related to the knowledge from the link you posted below. As you can see we picked a simple query with INNER JOIN between two indexed tables where postgres 8.3 and 9.0 decides to not use existing indexes for whatever reason.
select oi.id from order_items oi inner join clients_orders co on oi.order_id = co.id;
Lawrence Cohan.
-----Original Message-----
From: Kevin Grittner [mailto:Kevin.Grittner@wicourts.gov]
Sent: March-30-11 1:33 PM
To: pgsql-bugs@postgresql.org; Lawrence Cohan
Subject: RE: [BUGS] Postgres not using indexes
Lawrence Cohan <LCohan@web.com> wrote:
> From: Kevin Grittner [mailto:Kevin.Grittner@wicourts.gov]
>> [configuration advice]
>> If, after reading the above-cited page and tuning your server you
>> still have performance problems, pick one query to work on first,
>> and follow the step outlined here:
>>
>> http://wiki.postgresql.org/wiki/SlowQueryQuestions> We thank you for the links that have a lots of info and please
> note that we tuned our servers as recommended by Enterprise DB
> experts while they were in house for our hardware/software
> migrations and the setting you mentioned are in place already.
Then the next step would be to provide enough information on one of
the slow queries for people to be able to offer useful advice. Your
other post showed the query and the EXPLAIN ANALYZE output, but the
other information listed in the above-cited page is useful when
trying to understand a problem. I'm particularly curious about the
data types of the id columns and the specifics of the index
definitions.
-Kevin
Attention:
The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy any copies.
Attachments:
debug_perf_issue.sql (application/octet-stream, 7.3K) download
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-bugs@postgresql.org
Cc: LCohan@web.com, Kevin.Grittner@wicourts.gov
Subject: Re: Postgres not using indexes
In-Reply-To: <965AA5440EAC094E9F722519E285ACEDAC5E66A55F@WWCEXCHANGE.web.web.com>
References: <965AA5440EAC094E9F722519E285ACEDAC5E66A53D@WWCEXCHANGE.web.web.com> <4D9317D3020000250003BF7B@gw.wicourts.gov> <965AA5440EAC094E9F722519E285ACEDAC5E66A556@WWCEXCHANGE.web.web.com> <4D9322E8020000250003BF8C@gw.wicourts.gov> <965AA5440EAC094E9F722519E285ACEDAC5E66A55F@WWCEXCHANGE.web.web.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