Re: ways to force index use?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Seth Ladd <seth(at)picklematrix(dot)net>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: ways to force index use?
Date: 2003-10-14 00:01:55
Message-ID: 3743.1066089715@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Seth Ladd <seth(at)picklematrix(dot)net> writes:
> My Table Columns (all bigints): start, stop, step1, step2, step3
^^^^^^^^^^^

> The Query: explain analyze select * from path where start = 653873 or
> start = 649967 or stop = 653873 or stop = 649967

> Does anyone have a suggestion on how to get that query to use an index?

Coerce the constants to bigint, for starters. However, a query that is
selecting almost 10% of the table, as your example is, probably
*shouldn't* be using an index.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2003-10-14 00:07:05 Re: Heading to final release
Previous Message Josh Berkus 2003-10-13 23:55:25 Re: ways to force index use?

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2003-10-14 00:11:55 Re: go for a script! / ex: PostgreSQL vs. MySQL
Previous Message Christopher Browne 2003-10-13 23:58:36 Re: go for a script! / ex: PostgreSQL vs. MySQL