Re: index and seq scan - Mailing list pgsql-general

From Tom Lane
Subject Re: index and seq scan
Date
Msg-id 22181.1010692611@sss.pgh.pa.us
Whole thread Raw
In response to index and seq scan  (Tina Messmann <tina.messmann@xinux.de>)
List pgsql-general
Tina Messmann <tina.messmann@xinux.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

pgsql-general by date:

Previous
From: Jason Earl
Date:
Subject: Re: index and seq scan
Next
From: Jim Martinez
Date:
Subject: duplicating tables (accross databases)