Fwd: Bad query performance with more conditions?
От | kaifeng.zhu |
---|---|
Тема | Fwd: Bad query performance with more conditions? |
Дата | |
Msg-id | AANLkTimC01-Kvp36-sZ5Is79TAZWK54NXwH5MtYxJs5t@mail.gmail.com обсуждение исходный текст |
Ответ на | Bad query performance with more conditions? ("kaifeng.zhu" <cafeeee@gmail.com>) |
Ответы |
Re: Bad query performance with more conditions?
|
Список | pgsql-general |
<resend to mailing list> On Thu, Jun 24, 2010 at 16:57, Thom Brown <thombrown@gmail.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@domain.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@domain.com'::text) Filter: (email_msg_id = '4dba381b-f55e-02d3-4b4a-95e2e98178e2'::bpchar) (4 rows)
В списке pgsql-general по дате отправления: