Empty partition query plans

At this point, the partitions are all in place, but the data is still in the parent table. Since these are new tables, the optimizer doesn't have any statistics on them until ANALYZE is run. Let's do that and see what a query against the orders table looks like now:

ANALYZE; EXPLAIN ANALYZE SELECT * FROM orders; QUERY PLAN ---------- Result (cost=0.00..456.40 rows=23640 width=45) (actual time=0.064..99.059 rows=12000 loops=1) -> Append (cost=0.00..456.40 rows=23640 width=45) (actual time=0.059..58.873 rows=12000 loops=1) -> Seq Scan on orders (cost=0.00..220.00 rows=12000 width=36) (actual time=0.056..22.522 rows=12000 loops=1) -> Seq Scan on orders_2004_01 orders (cost=0.00..19.70 rows=970 width=54) (actual time=0.001..0.001 ...

Get PostgreSQL 10 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.