Skip to content

How to partition by date whilst supporting constraint exclusion on both start/end timestamp columns #382

Answered by keithf4
atomaras asked this question in Q&A
Discussion options

You must be logged in to vote

The extra constraints that apply_constraints provides would be the way to do this since pg_partman currently only supports single column partitioning. That should work for you, but I probably won't be able to adapt that code back into pg_partman at this time since this is very specific to your use-case.

But honestly, this may be a better candidate for using the ranged data type (tstzrange) depending on your usage.

https://www.postgresql.org/docs/13/rangetypes.html
https://www.postgresql.org/docs/13/functions-range.html

This data type isn't currently supported in partitioning as far as I'm aware, but it can make writing queries for time ranges like this significantly easier and provides ma…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@atomaras
Comment options

@atomaras
Comment options

@keithf4
Comment options

@atomaras
Comment options

@keithf4
Comment options

Answer selected by keithf4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants