> but a select like this takes ages (looooong time):
> # select * from file where id = 1921773;
> id | name
> -----+----------------
> 1921777 | icons
>
I believe the reason is this : the numeric literal is first considered an int4
becuase it falls within the range of int4 (-2147483648 to +2147483647).
try quoting the literal like this:
# select * from file where id = '1921773';
This forces the literal to be evaluated. If you do an explain on that query
... you should see that the query planner uses the index as expected and that
the condition used on the index is using the literal value cast to a big int.
That's just my understanding anyway.
Andy