Re: ways to force index use?

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Seth Ladd <seth(at)picklematrix(dot)net>, pgsql-performance(at)postgresql(dot)org
Subject: Re: ways to force index use?
Date: 2003-10-13 23:55:25
Message-ID: 200310131655.25022.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Seth,

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

you need to cast all those numbers to BIGINT:

select * from path where start = 653873::BIGINT or
start = 649967::BIGINT or stop = 653873::BIGINT or stop = 649967::BIGINT

Then an index on start or stop should be used by the planner.

--
-Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-10-14 00:01:55 Re: ways to force index use?
Previous Message Mike Preece 2003-10-13 23:51:28 Re: Dreaming About Redesigning SQL

Browse pgsql-performance by date

  From Date Subject
Next Message Christopher Browne 2003-10-13 23:58:36 Re: go for a script! / ex: PostgreSQL vs. MySQL
Previous Message Seth Ladd 2003-10-13 23:48:15 ways to force index use?