try to run the the following
> sql. the index should be used.
>
> explain SELECT md.*
>FROM measure_data md
>where telegram_id in (trunc(66484.2),trunc(132362.1 ))
>
>
> 2014-05-15 17:28 GMT+09:00 changchao
> mailto:chang-c...@hotmail.com>>
Interestingly,adding type cast made postgresql wiser.
Anyone knows the reason?
1.no type cast
SELECT md.*
FROM measure_data md
where telegram_id in (trunc(66484.2),trunc(132362.1 ))
"Seq Scan on measure_data md (cost=0.00..459455.40 rows=205546 width=28)
(actual time=77.144..6458.870 row
Hi,David
Seems that the root of evil is in the function(random,trunc),
although I don't know why.
Here is the comparison.
1.w/o function : index is wisely used.(Even without the limit 30 clause)
explain analyze
SELECT md.*
FROM measure_data md
where telegram_id in
(
SELECT 66