I have a problem with the planner postgresql I had a table with several partitions, then added a considerable number of subsequent partitions. EXPLAIN on the main table does not show the new partitions. SELECT performed on the main table does not see the records added to new partitions, SELECT performed on new partitions sees records
For example:
- Table (id, partnumber, data)
- Tabela_part1 (CHECK partnumber = 1)
- Tabela_part2 (CHECK partnumber = 2)
...
- Tabela_part10 (CHECK partnumber = 10)
After adding new partitions
- Table (id, partnumber, data)
- Tabela_part1 (CHECK partnumber = 1)
- Tabela_part2 (CHECK partnumber = 2)
...
- Tabela_part100 (CHECK partnumber = 100)
DDL example for the new partition Table_part11:
create table Table_part11 ( CONSTRAINT table_part11_pkey PRIMARY KEY (id), CHECK ( partnumber = 11 ) ) inherits (Table)';
After
INSERT INTO Table(id, partnumber, data) VALUES(1234, 11, 'bla')
SELECT * FROM Tabela_part11 WHERE id = 1234
- It shows the record.
SELECT * FROM Table WHERE id = 1234
- It does not show the record
I tried
- Vacuum / analyze the main tabla and partitions
- Reindex index for indexes on main table and partitions
Please help