HypoPG / hypopg

Hypothetical Indexes for PostgreSQL
https://hypopg.readthedocs.io
Other
1.39k stars 59 forks source link

Modify hypo_generate_part_scheme() #21

Closed yuzupy closed 6 years ago

yuzupy commented 6 years ago

Modified the first part of the hypo_generate_part_scheme() for partition-wise join.

rjuju commented 6 years ago

Indeed, I totally missed the fact that partition-wise join relies on the fact that different partitioned table can share the same PartitionScheme.

However, I think we need more work here, because we'll have problem if we hypothetically partition two table with the same scheme, and then drop one of them (even if we can't drop only part of the hypothetical partition for now).

We shouldn't store the PartitionScheme when hypopg_partition_table() is called, but instead generate it at plan time, and add our own one to root->part_schemes if it's not present yet. as find_partition_scheme() is doing. This way, it'll also work if we try to join a hypothetically partitioned table with a real partitioned table.

yuzupy commented 6 years ago

Thank you for your comment.

Yes, indeed. That will be a problem.

And also, the PartitionScheme should be created and stored at plan time as you mentioned. If we do that, can we remove the PartitionScheme from the hypoTable?

rjuju commented 6 years ago

yes, it shouldn't be required anymore.