Re: PostgreSQL doesn't use indexes even is enable_seqscan - Mailing list pgsql-general

From Ricardo Junior
Subject Re: PostgreSQL doesn't use indexes even is enable_seqscan
Date
Msg-id Pine.LNX.4.44.0207090039030.642-100000@ricardo.localdomain
Whole thread Raw
In response to Re: PostgreSQL doesn't use indexes even is enable_seqscan  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-general
    Hi there,

> > I have a severe problem with PostgreSQL 7.2.1.
> > I have a table containing 500mio records (for testing purposes).
> > Indexes: idx_one_xmod
> > Unique keys: idx_one_id
> >
> > cluster=# SET enable_seqscan TO off;
> > SET VARIABLE
> > cluster=# SELECT * FROM one WHERE id=300000;

> You'll need to quote or explicitly cast the
> constant to bigint for the indexes to get used.
> It's a problem with the way numeric constants are
> handled.  They'll get prematurely forced to int4
> if they fit, and won't promote for index use.

    Perhaps this should be added to the Documentation in the indexes
part. I had the same problem last week and I guess it's a very common and
frequent question.

    []'s
    Ricardo.





pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Speeding up subselect ?
Next
From: Thomas Lockhart
Date:
Subject: Re: I am being interviewed by OReilly