Re: Bad query performance with more conditions? - Mailing list pgsql-general

From Thom Brown
Subject Re: Bad query performance with more conditions?
Date
Msg-id AANLkTim5cw5pXnK90UTTrv2zL15eSsItKblOw6MRfJTF@mail.gmail.com
Whole thread Raw
In response to Bad query performance with more conditions?  ("kaifeng.zhu" <cafeeee@gmail.com>)
List pgsql-general
On 24 June 2010 09:52, kaifeng.zhu <cafeeee@gmail.com> wrote:
> Hi All,
>
> I have a table named emails which created by following script:
> create table emails (
>    email_id bigserial primary key,
>    email_msg_id char(36) not null,
>    email_sender text not null)
>
> The table has more than 10 million of records and I have already
> created indexes on email_msg_id and email_sender
>
> Following script finished very quickly (less than 1 seconds):
>    select * from emails where email_msg_id =
> '4dba381b-f55e-02d3-4b4a-95e2e98178e2' limit 1
> But a similar script cost more than ten seconds:
>    select * from emails where email_msg_id =
> '4dba381b-f55e-02d3-4b4a-95e2e98178e2' and email_sender_text =
> 'sender@domain.com' limit 1
>
> Both those scripts returns 0 rows of records indeed.
>
> Any comment are highly appreciated.
>

Sounds like the planner took a wrong turn in the 2nd case.  Which
version of PostgreSQL are you running?

Thom

pgsql-general by date:

Previous
From: "J. Roeleveld"
Date:
Subject: Re: The case of PostgreSQL on NFS Server
Next
From: "kaifeng.zhu"
Date:
Subject: Fwd: Bad query performance with more conditions?