79651436

Date: 2025-06-03 14:45:44
Score: 1
Natty:
Report link

Something to try:
Make sure you have enable_partition_pruning set to on. I believe documentation states that is the default, but I found it not set before.

https://www.postgresql.org/docs/current/ddl-partitioning.html#DDL-PARTITION-PRUNING

See how it compares for you:

-- see if EXPLAIN is different when pruning is ON
SET enable_partition_pruning = on;
EXPLAIN analyse select * from "IpLocation" where "IpFrom"<=1503395841 and "IpTo">=1503395841 limit 1;

-- compare when pruning is OFF
SET enable_partition_pruning = off;
EXPLAIN analyse select * from "IpLocation" where "IpFrom"<=1503395841 and "IpTo">=1503395841 limit 1;
Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Justin Taylor