Re: Use of index for 50% column restriction - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Use of index for 50% column restriction
Date
Msg-id 2416.1465406934@sss.pgh.pa.us
Whole thread Raw
In response to Use of index for 50% column restriction  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Use of index for 50% column restriction  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
Bruce Momjian <bruce@momjian.us> writes:
> As part of my research on the parsing/planning behavior of PREPARE, I
> found a surprising behavior --- a WHERE clause that is 50% restrictive
> is using an index.  I thought only <10% restrictions used indexes.

There's no such hard-and-fast rule.  The cost estimate break point depends
greatly on the index order correlation (which is 100% in your example),
as well as some other factors like the index size versus
effective_cache_size.

For randomly-ordered data I believe the cutover is actually well below 10%.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Use of index for 50% column restriction
Next
From: Robert Haas
Date:
Subject: Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <