koposov@ast.cam.ac.uk writes:
> I have a large table (few Tb) partitioned in ~ 12000 smaller tables, using
> inheritance from the parent one.
That's an utterly insane number of partitions.
> I noticed that when the user tried to query from the parent table
> (not something we plan to do often), PG run out of memory (128 Gb on our
> machine).
I'm unsurprised.
The inheritance infrastructure is only designed to support maybe 100
child tables. If we ever get around to implementing a hard-wired
partitioning scheme, it's possible that multiple thousands of partitions
could be practical, but it isn't today. Sorry.
regards, tom lane