Hi,
I have got a table with a non-unique integer value named "dam_id" and I
need to query the max(dam_id) value. Also put an index on that column, but
postgres always does a seq scan, which takes half a minute to complete.
Column | Type | Modifiers
---------------+---------------------------------+----------------------
dam_id | integer |
[...]
Indexes: ix_dam_dam_id
EXPLAIN SELECT MAX(dam_id) FROM dam;
NOTICE: QUERY PLAN:
Aggregate (cost=5774.65..5774.65 rows=1 width=4)
-> Seq Scan on dam (cost=0.00..5442.92 rows=132692 width=4)
Another note: I vacuum full analyzed the table. Didn't help either.
Errrr, yes, I am porting a mySQL application to postgres, cause postgres
offers me the features I need for that app. Brought back the fun of adding
new features to my application :-)
Kind regards
... Ralph ...