Re: index and seq scan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tina Messmann <tina(dot)messmann(at)xinux(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: index and seq scan
Date: 2002-01-10 19:56:51
Message-ID: 22181.1010692611@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tina Messmann <tina(dot)messmann(at)xinux(dot)de> writes:
> [ appid < 10 uses an index, appid > 10 does not ]

This is not wrong. An indexscan only wins over a sequential scan if the
indexscan can scan a fairly small percentage of the table --- the
critical percentage varies, but let's say it's 5%. If appid < 10
selects less than 5% of the table, then appid > 10 must select more than
95% of the table. Accordingly, choosing a seqscan for the second query
is the right thing to do.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2002-01-10 20:11:39 Re: index and seq scan
Previous Message Jelan 2002-01-10 19:48:06 Re: URGENT: pg_dump & Postgres 7.2b4