From: | "kaifeng(dot)zhu" <cafeeee(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Fwd: Bad query performance with more conditions? |
Date: | 2010-06-24 09:13:49 |
Message-ID: | AANLkTimC01-Kvp36-sZ5Is79TAZWK54NXwH5MtYxJs5t@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
<resend to mailing list>
On Thu, Jun 24, 2010 at 16:57, Thom Brown <thombrown(at)gmail(dot)com> wrote:
> Sounds like the planner took a wrong turn in the 2nd case. Which
> version of PostgreSQL are you running?
PostgreSQL version 8.1.21 (With schemas)
The explain commands show that:
db1=> explain select * from emails where email_msg_id =
'4dba381b-f55e-02d3-4b4a-95e2e98178e2' limit 1;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------
Limit (cost=0.00..4.00 rows=1 width=184)
-> Index Scan using idx_emails_email_msg_id on emails
(cost=0.00..370016.42 rows=92413 width=184)
Index Cond: (email_msg_id =
'4dba381b-f55e-02d3-4b4a-95e2e98178e2'::bpchar)
(3 rows)
db1=> explain select * from emails where email_msg_id =
'4dba381b-f55e-02d3-4b4a-95e2e98178e2' and email_sender =
'sender(at)domain(dot)com' limit 1;
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.00..801.06 rows=1 width=184)
-> Index Scan using idx_emails_email_sender on emails
(cost=0.00..370089.46 rows=462 width=184)
Index Cond: (email_sender = 'sender(at)domain(dot)com'::text)
Filter: (email_msg_id = '4dba381b-f55e-02d3-4b4a-95e2e98178e2'::bpchar)
(4 rows)
From | Date | Subject | |
---|---|---|---|
Next Message | Alban Hertroys | 2010-06-24 09:14:15 | Re: Bad query performance with more conditions? |
Previous Message | Thom Brown | 2010-06-24 08:57:57 | Re: Bad query performance with more conditions? |