cast affects use of indexes ?

From: Alex Vinogradovs <AVinogradovs(at)clearpathnet(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: cast affects use of indexes ?
Date: 2008-07-23 22:37:29
Message-ID: 1216852649.4848.139.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Guys,

I've got a table with an indexed column of a numeric user
type (implemented in C). When I run a select on that table
in a form of :

select * from sometable where column = 89464;

sequential scan is used...

When I rewrite the query to use cast like this :

select * from sometable where column = 89464::mytype;

bitmap index scan and bitmap heap scan are used.

Is it possible to make it work properly without
use of explicit casts ? Thanks!

Best regards,
Alex Vinogradovs

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kevin Neufeld 2008-07-23 22:47:37 contrib catalogs
Previous Message Alvaro Herrera 2008-07-23 22:19:23 Re: How support more native locale in one cluster?