Skip to content

Postgres chooses wrong index on DISTINCT block_num

SELECT DISTINCT block_num 
FROM hive.operations_view 
WHERE op_type_id = 0 
ORDER BY block_num DESC 
LIMIT 100

for some operations (I found problematic for now 0,72 - vote and effective_vote operations, there is more than these two) postgres planner doesn't choose our index on hive.operations (it chooses seq scan)

Edited by Michal Zander