Re: index vs seqscan question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Frank Bax <fbax(at)sympatico(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: index vs seqscan question
Date: 2002-11-22 22:30:41
Message-ID: 28753.1038004241@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Frank Bax <fbax(at)sympatico(dot)ca> writes:
> OK, I should have finished testing my changes before posting - the
> new/faster query should have brackets around (typ=' ' OR typ='A'), but its
> still fast as lightning! I don't think it made a big difference to explain
> results, but it appears seqscan is cheaper than it was before?

The version with the typo couldn't use an indexscan, I think (planner's
not real smart about asymmetrical AND/OR structures). The fixed
version is probably going for seqscan because with the additional AND
condition, it's estimating fewer rows need to be sorted. The seqscan
isn't getting cheaper, but the sort is.

Looking only at the planner's estimates is not very reliable though.
What does EXPLAIN ANALYZE have to say?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Eric B.Ridge 2002-11-22 23:22:43 Re: UNION and array types
Previous Message Frank Bax 2002-11-22 21:54:35 Re: index vs seqscan question