Unexpected query plan - Mailing list pgsql-general

From Dave Cramer
Subject Unexpected query plan
Date
Msg-id 014201c0e2b4$543257f0$0401a8c0@INSPIRON
Whole thread Raw
In response to how to convert Access to PG unless odbc driver(with sql file)  (Ludovico Romano <romanolu@itc.it>)
Responses Re: Unexpected query plan  (Peter Eisentraut <peter_e@gmx.net>)
Re: Unexpected query plan  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-general
Hi All,

Below is a simple table with an index on phonenumber, if I do a select on
phonenumber without quotes then it does a sequence scan?? If I do put
quotes, then it does use the index scan??? Anyone know what's going on?

The version of postgres is 7.1

Regards,

Dave

test=# create table custbase (phonenumber int8, svctype char, svcchoice
char, billtype char, ctype char);
CREATE
test=# create index custbaseidx on custbase (phonenumber);
CREATE
test=# \d custbase
           Table "custbase"
  Attribute  |     Type     | Modifier
-------------+--------------+----------
 phonenumber | bigint       |
 svctype     | character(1) |
 svcchoice   | character(1) |
 billtype    | character(1) |
 ctype       | character(1) |
Index: custbaseidx

test=# explain select * from custbase where phonenumber=5199400858;
NOTICE:  QUERY PLAN:

Seq Scan on custbase  (cost=0.00..25.00 rows=10 width=56)

EXPLAIN
test=# explain select * from custbase where phonenumber='5199400858';
NOTICE:  QUERY PLAN:

Index Scan using custbaseidx on custbase  (cost=0.00..8.14 rows=10 width=56)





pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Re: [GENERAL] Queries across multiple databases ?(was: SELECT from a table in another database).
Next
From: Alex Pilosov
Date:
Subject: Re: how to convert Access to PG unless odbc driver(with sql file)