*really* simple select doesn't use indices ...

From: "Marc G(dot) Fournier" <scrappy(at)hub(dot)org>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: *really* simple select doesn't use indices ...
Date: 2001-05-29 03:39:52
Message-ID: Pine.BSF.4.33.0105282334270.12563-100000@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


First, this is still a v7.1 system ... its totally possible that this is
long fixed, and I'm way overdue to get it to v7.1.2, which I'll gladly
accept as a response ...

That said ... seems like a very painful way to arrive at 1 row ... :)

table structure:

globalmatch=# \d locations
Table "locations"
Attribute | Type | Modifier
-----------+---------+--------------------------------------------------------
gid | integer | not null default nextval('locationstmp_gid_seq'::text)
city | text |
state | text |
country | text |
zip | text |
location | point |
Indices: locations_zip,
locationstmp_gid_key

globalmatch=# \d locations_zip
Index "locations_zip"
Attribute | Type
-----------+------
zip | text
btree

globalmatch=# EXPLAIN SELECT count(location) from locations WHERE zip = '80012';
NOTICE: QUERY PLAN:

Aggregate (cost=2950.18..2950.18 rows=1 width=16)
-> Seq Scan on locations (cost=0.00..2939.64 rows=4217 width=16)

EXPLAIN

globalmatch=# SELECT count(location) from locations WHERE zip = '80012';
count
-------
1
(1 row)

globalmatch=# SELECT count(location) from locations;
count
--------
123571
(1 row)

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zeugswetter Andreas SB 2001-05-29 07:28:26 AW: User functions and AIX
Previous Message Joe Conway 2001-05-29 02:55:37 Re: Re: [INTERFACES] remote database queries