DDL support for partitioning #5360
Replies: 3 comments 6 replies
-
I don't hate it, but I'm still sorta struggling to see myself wanting to write this mess of annotations rather than just writing fragments of native SQL in, say,
Or, alternatively:
I think this would be much easier to implement, and probably also easier to use. If there's a need for "portable" cross-dialect partitioning, which I just don't see as something that's like to be common at all, then we could easily add That way we would let the user customize partitioning for the particular database, and their particular needs, rather than struggle by ourselves to abstract out some sort of lowest-common-denominator partitioning facility, where the abstraction would by nature not even be very transparent. WDYT, @beikov ? |
Beta Was this translation helpful? Give feedback.
-
A few comments related to Oracle. Since 11g release, you have:
Since 12cR2, you have:
Also, Oracle supports 2 levels of partitioning (called sub-partitioning) such as partition by interval and then by list. Finally, regarding point 3 above, Oracle allows partitioning a non-partitioned table online without schema export/import since 12cR2. |
Beta Was this translation helpful? Give feedback.
-
Moving the discussion from #5353 to here, the idea is to introduce the following annotations which will be used for emitting partitioning DDL in hbm2ddl.
@PartitionByRange({ @RangePartition(name = "...", from = "...", to = "...") }) // from is inclusive, to is exclusive
@PartitionByList({ @ListPartition(name = "...", keys = {...}) })
@PartitionByHash({ @HashPartition(name = "...") }) // modulus is determined by count of partitions, index determines remainder value
I'll list the databases that have some support for partitioning:
For databases that don't support partitioning we simply don't generate DDL or fail. Partitioning is a tool for data management but it shouldn't matter semantically if partitioning is used or not.
The only part I am unsure about is range partitioning since SQL Server uses inclusive bounds, we can't just omit the
from
member and infer that through the order of defined partitions, as we will have to useLEFT
bound values for the DDL on SQL Server. We could think about dropping theto
member though, as we could infer that from the next partition value and for the last partition, use the specialMAXVALUE
. So I am pretty sure we could supportto generate
Beta Was this translation helpful? Give feedback.
All reactions