pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Dmitry Tkach <dmitry@openratings.com>
Cc: pgsql-general@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Why is it not using an index?
Date: Fri, 15 Mar 2002 10:18:43 -0800 (PST)
Message-ID: <20020315101751.N51975-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <3C924680.4090806@openratings.com>


On Fri, 15 Mar 2002, Dmitry Tkach wrote:

> This must be really simple, but I just can't get it :-(
> I have a table (a) with a single column (x):
>
>            Table "a"
>   Attribute |   Type   | Modifier
> -----------+----------+----------
>   x         | smallint |
> Index: a_idx
>
>
>     Index "a_idx"
>   Attribute |   Type
> -----------+----------
>   x         | smallint
> btree
>
> The table has 10000000 rows....
>
> Now, how come, when I do:
>
> explain select * from a where x=3;

You'll need to cast the 3 into smallint explicitly, either
3::smallint or CAST(3 as smallint) should work.





view thread (11+ messages)  latest in thread

Message-ID: <20020315101751.N51975-100000@megazone23.bigpanda.com>
Permalink:  ../20020315101751.N51975-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20020315101751.N51975-100000@megazone23.bigpanda.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: sszabo@megazone23.bigpanda.com, dmitry@openratings.com, pgsql-general@postgresql.org
  Subject: Re: [SQL] Why is it not using an index?
  In-Reply-To: <20020315101751.N51975-100000@megazone23.bigpanda.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