Re: index on INT8 column is never used

From: Shridhar Daithankar <shridhar_daithankar(at)persistent(dot)co(dot)in>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: index on INT8 column is never used
Date: 2003-05-05 15:43:20
Message-ID: 200305052113.20155.shridhar_daithankar@nospam.persistent.co.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday 05 May 2003 20:24, Maurice Balick wrote:
> nf=# explain select account_id from transactions where timestamp =
> 1052101817212;
> NOTICE: QUERY PLAN:
>
> Seq Scan on transactions (cost=0.00..40414.88 rows=3855 width=4)

Try
nf=# explain select account_id from transactions where timestamp =
1052101817212::int8;

That is postgresql's way of typecasting. It is probably first in the FAQ...

But BTW, if it is returning 4000 rows, it might still default to sequential
scan.. You need to lower random_page_cost in postgresql.conf to raise the
threshold at which pg flips from index scan to seq. scan..

HTH

Shridhar

--
Nasrudin was carrying home a piece of liver and the recipe for liver
pie. Suddenly a bird of prey swooped down and snatched the piece of
meat from his hand. As the bird flew off, Nasrudin called after it,
"Foolish bird! You have the liver, but what can you do with it without
the recipe?"

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bob Krus 2003-05-05 16:05:12 GENERAL: PosgreSQL Inquiry
Previous Message Dennis Gearon 2003-05-05 15:13:14 Re: Database server restarting