Re: index question - Mailing list pgsql-general

From Jan Wieck
Subject Re: index question
Date
Msg-id 3F9DCD77.5060607@Yahoo.com
Whole thread Raw
In response to index question  ("Rick Gigger" <rick@alpinenetworking.com>)
List pgsql-general
Rick Gigger wrote:

> I have heard that postgres will not use an index unless the field has a
> not null constraint on it.  Is that true?

Certainly not. PostgreSQL reserves the right not to use an index, for
example if it thinks that most of the table will satisfy the condition
anyway (for example if a table has keys in the range from 1 to 1,000,000
and you query for > 1,000 ... using the index doesn't make sense). But
claiming it will not use one if the field is allowed to contain NULL is
plainly wrong.


Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #


pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: index question
Next
From: George Essig
Date:
Subject: Re: connectby