I'd like to cluster a PostgreSQL table based on information in other tables.
Imagine two tables - foos (id, baz_id, name) and bars (foo_id, name). bars.foo_id is a foreign key reference to foos.id.
I'd like to cluster the bars table so that it is ordered by foos.baz_id.
Is this possible?
barsrelated tofoosthat have the samebaz_idwill be returned in the same query. None of the other columns onbarscan simulate that ordering (althoughfoo_idisn't horrible). I expect this will decrease IO read time significantly on a several hundred million record table.