I'll use the index when I'm good and ready!

From: David Gilbert <dgilbert(at)velocet(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: I'll use the index when I'm good and ready!
Date: 1998-07-06 20:00:44
Message-ID: 199807062000.QAA22467@trooper.velocet.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Below, I've cut out a little dialogue between postgres and I. This
puzzles me. Why am I forced to a sequential scan if the query does
not include the indexed item? I'm sure that I've done this before
without these results... but the database is just so sticky about this
point.

loggrok=> create index devil_dupi on devil_dup(item);
CREATE
loggrok=> explain select id from devil_dup where item='/';
NOTICE: QUERY PLAN:

Seq Scan on devil_dup (cost=0.00 size=0 width=4)

EXPLAIN
loggrok=> vacuum;
VACUUM
loggrok=> explain select id from devil_dup where item='/';
NOTICE: QUERY PLAN:

Seq Scan on devil_dup (cost=0.00 size=0 width=4)

EXPLAIN
loggrok=> explain select id,item from devil_dup where item='/';
NOTICE: QUERY PLAN:

Index Scan on devil_dup (cost=0.00 size=0 width=16)

EXPLAIN
loggrok=> \d devil_dup

Table = devil_dup
+----------------------------------+----------------------------------+-------+
| Field | Type | Length|
+----------------------------------+----------------------------------+-------+
| id | int4 | 4 |
| item | text | var |
+----------------------------------+----------------------------------+-------+

Browse pgsql-general by date

  From Date Subject
Next Message Paul Mullen 1998-07-06 20:44:56 Re: [GENERAL] Alphabetical sorting...
Previous Message Chris Johnson 1998-07-06 19:50:18 Alphabetical sorting...