Re: index question

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Rick Gigger <rick(at)alpinenetworking(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: index question
Date: 2003-10-28 01:59:19
Message-ID: 3F9DCD77.5060607@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)Yahoo(dot)com #

In response to

Browse pgsql-general by date

  From Date Subject
Next Message George Essig 2003-10-28 02:23:56 Re: connectby
Previous Message Bruce Momjian 2003-10-28 01:54:22 Re: index question