On Mon, 9 Aug 2004, Dan Ruthers wrote:
> Now, if I run this query (note the int8 cast - also tried with the '' cast to String, same results):
> test=> explain select * from dmaildatum where idparent=int8(783219);
> QUERY PLAN
> ------------------------------------------------------------------
> Seq Scan on dmaildatum (cost=0.00..2241.71 rows=2229 width=272)
> Filter: (idparent = 783219::bigint)
> (2 rows)
>
> The index is not used. But with an identical query, only different parameter value:
> desknow=> explain select * from dmaildatum where idparent=int8(1187838);
> QUERY PLAN
>
> --------------------------------------------------------------------------------
> ---------------
> Index Scan using ix_dmaildatum_idparent on dmaildatum (cost=0.00..284.05 rows=
> 102 width=272)
> Index Cond: (idparent = 1187838::bigint)
> (2 rows)
Look at the row estimates for the two cases. How many rows are actually
returned and how long the queries take (explain analyze will give that
information)?