Quantcast
Channel: Tadek's Blog » Databases
Viewing all articles
Browse latest Browse all 10

Slow aggergate queries in PostgreSQL

$
0
0

Postgres is strange. If you make a query

select min(column_with_index) from table;

the database performs a sequential scan – you can only imagine how long it takes on a 10M record database. This seems to be a feature (!@!#!@), but indices can will used if you use the following workaround:

select column_with_index from table order by 1 (desc) limit 1;

This trick is explained here.


Viewing all articles
Browse latest Browse all 10

Trending Articles