Re: Strange query plan

From: "Dmitry Teslenko" <dteslenko(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Strange query plan
Date: 2008-08-14 11:48:49
Message-ID: 91325fec0808140448l6cf2db2di4ea4ac23e901b361@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Aug 14, 2008 at 15:30, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> Am Thursday, 14. August 2008 schrieb Dmitry Teslenko:
>> SELECT SUM(...) FROM table1 WHERE field3 = 'ABC' AND field1 <> 1
>> GROUP BY field2
>>
>> And planner picks up a sequential scan of a table. Why does he?
>
> Presumably because it thinks it is the best plan, and I see no reason to doubt
> that outright. You might get better performance with an index on field3.
>

Why then idx2 on field1 and field3 don't help here?

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martin Gainty 2008-08-14 11:57:17 Re: Strange query plan
Previous Message Gregory Stark 2008-08-14 11:33:47 Re: Postgres 8.3 is not using indexes