pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: pgsql-performance@postgresql.org
Cc: tomas@nocrew.org
Subject: Re: Query is not using index when it should
Date: Sun, 12 Dec 2004 18:48:27 -0800
Message-ID: <200412121848.27513.josh@agliodbs.com> (raw)
In-Reply-To: <80oeh2tm7x.fsf@junk.nocrew.org>
References: <80oeh2tm7x.fsf@junk.nocrew.org>

Tomas,

> I tried to subscribe to pgsql-performance, but there seems to be
> something wrong with the majordomo, so I'm sending to general too,
> where I'm already subscribed.

Well, I got your e-mail, so obviously you're subscribed to Performance.

> But when doing a search with objectid, class and field, it doesn't use
> the idx_cjm_object1 index.
> db=# explain analyze select * from cjm_object where objectid=4534 and
> class=12 and field='paroid'; QUERY PLAN

Try:

explain analyze select * from cjm_object where objectid=4534::BIGINT and
class=12 and field='paroid';

Sometimes the planner needs a little extra help on BIGINT fields.   This 
problem is fixed in 8.0.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco



view thread (7+ messages)

Message-ID: <200412121848.27513.josh@agliodbs.com>
Permalink:  ../200412121848.27513.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200412121848.27513.josh@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, pgsql-performance@postgresql.org, tomas@nocrew.org
  Subject: Re: Query is not using index when it should
  In-Reply-To: <200412121848.27513.josh@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox