I’ve discovered some very strange and counter-intuitive behaviour in PostgreSQL. I have a query structure as follows. I am selecting both the IDs and the count from a subquery. The subquery does the …
Tag: query-performance
Why does this simple query not use the index in postgres?
In my postgreSQL database I have a table named “product”. In this table I have a column named “date_touched” with type timestamp. I created a simple btree index on this column. This is the schema of my table (I omitted irrelevant column & index definitions): The table has ~300,000 rows and I want to get the n-th element from the