Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-27328

Change of SYSTEM_TIME partitioning options is not possible without data copy

Details

    Description

      When we need to add/remove or change LIMIT, INTERVAL, AUTO we have to recreate partitioning from scratch. Such operations should be done fast. To remove options like LIMIT or INTERVAL one should write:

      alter table t1 partition by system_time;
      

      The command checks whether it is new or existing SYSTEM_TIME partitioning. And in the case of new it behaves as CREATE would do: adds default number of partitions (2). If SYSTEM_TIME partitioning already existed it just changes its options: removes unspecified ones and adds/changes those specified explicitly. In case when partitions list was supplied it behaves as usual: does full repartitioning.

      Examples:

      create or replace table t1 (x int) with system versioning
      partition by system_time limit 100 partitions 4;
      # Change LIMIT
      alter table t1 partition by system_time limit 33;
      # Remove LIMIT
      alter table t1 partition by system_time;
      # This does full repartitioning
      alter table t1 partition by system_time limit 33 partitions 4;
      # This does data copy as pruning will require records in correct partitions
      alter table t1 partition by system_time interval 1 hour
      starts '2000-01-01 00:00:00';
      # But this works fast, LIMIT will apply to DML commands
      alter table t1 partition by system_time limit 33;
      

      Attachments

        Issue Links

          Activity

            midenok Aleksey Midenkov created issue -
            midenok Aleksey Midenkov made changes -
            Field Original Value New Value
            Description When we need to add/remove or change LIMIT, INTERVAL, AUTO (10.8 and more) we have to recreate partitioning from scratch. Such operations should be done fast. To remove options like LIMIT or INTERVAL one should write:

            alter table t1 partition by system_time;

            The command checks whether it is new or existing SYSTEM_TIME partitioning. And in the case of new it behaves as CREATE would do: adds default number of partitions (2). If SYSTEM_TIME partitioning already existed it just changes its options: removes unspecified ones and adds/changes those specified explicitly. In case when partitions list was supplied it behaves as usual: does full repartitioning.

            Examples:

            create or replace table t1 (x int) with system versioning
            partition by system_time limit 100 partitions 4;
            # Change LIMIT
            alter table t1 partition by system_time limit 33;
            # Remove LIMIT
            alter table t1 partition by system_time;
            # This does data copy as pruning will require records in correct partitions
            alter table t1 partition by system_time interval 1 hour
            starts '2000-01-01 00:00:00';
            # But this works fast, LIMIT will apply to DML commands
            alter table t1 partition by system_time limit 33;
            When we need to add/remove or change LIMIT, INTERVAL, AUTO (10.8 and more) we have to recreate partitioning from scratch. Such operations should be done fast. To remove options like LIMIT or INTERVAL one should write:

            {code:sql}
            alter table t1 partition by system_time;
            {code}

            The command checks whether it is new or existing SYSTEM_TIME partitioning. And in the case of new it behaves as CREATE would do: adds default number of partitions (2). If SYSTEM_TIME partitioning already existed it just changes its options: removes unspecified ones and adds/changes those specified explicitly. In case when partitions list was supplied it behaves as usual: does full repartitioning.

            Examples:
            {code:sql}
            create or replace table t1 (x int) with system versioning
            partition by system_time limit 100 partitions 4;
            # Change LIMIT
            alter table t1 partition by system_time limit 33;
            # Remove LIMIT
            alter table t1 partition by system_time;
            # This does data copy as pruning will require records in correct partitions
            alter table t1 partition by system_time interval 1 hour
            starts '2000-01-01 00:00:00';
            # But this works fast, LIMIT will apply to DML commands
            alter table t1 partition by system_time limit 33;
            {code}
            midenok Aleksey Midenkov made changes -
            Component/s Partitioning [ 10802 ]
            Component/s Versioned Tables [ 14303 ]
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.8 [ 26121 ]
            Affects Version/s 10.3 [ 22126 ]
            Affects Version/s 10.8 [ 26121 ]
            Assignee Aleksey Midenkov [ midenok ]
            midenok Aleksey Midenkov made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            midenok Aleksey Midenkov made changes -
            midenok Aleksey Midenkov made changes -
            Description When we need to add/remove or change LIMIT, INTERVAL, AUTO (10.8 and more) we have to recreate partitioning from scratch. Such operations should be done fast. To remove options like LIMIT or INTERVAL one should write:

            {code:sql}
            alter table t1 partition by system_time;
            {code}

            The command checks whether it is new or existing SYSTEM_TIME partitioning. And in the case of new it behaves as CREATE would do: adds default number of partitions (2). If SYSTEM_TIME partitioning already existed it just changes its options: removes unspecified ones and adds/changes those specified explicitly. In case when partitions list was supplied it behaves as usual: does full repartitioning.

            Examples:
            {code:sql}
            create or replace table t1 (x int) with system versioning
            partition by system_time limit 100 partitions 4;
            # Change LIMIT
            alter table t1 partition by system_time limit 33;
            # Remove LIMIT
            alter table t1 partition by system_time;
            # This does data copy as pruning will require records in correct partitions
            alter table t1 partition by system_time interval 1 hour
            starts '2000-01-01 00:00:00';
            # But this works fast, LIMIT will apply to DML commands
            alter table t1 partition by system_time limit 33;
            {code}
            When we need to add/remove or change LIMIT, INTERVAL, AUTO (10.8 and more) we have to recreate partitioning from scratch. Such operations should be done fast. To remove options like LIMIT or INTERVAL one should write:

            {code:sql}
            alter table t1 partition by system_time;
            {code}

            The command checks whether it is new or existing SYSTEM_TIME partitioning. And in the case of new it behaves as CREATE would do: adds default number of partitions (2). If SYSTEM_TIME partitioning already existed it just changes its options: removes unspecified ones and adds/changes those specified explicitly. In case when partitions list was supplied it behaves as usual: does full repartitioning.

            Examples:
            {code:sql}
            create or replace table t1 (x int) with system versioning
            partition by system_time limit 100 partitions 4;
            # Change LIMIT
            alter table t1 partition by system_time limit 33;
            # Remove LIMIT
            alter table t1 partition by system_time;
            # This does full repartitioning
            alter table t1 partition by system_time limit 33 partitions 6;
            # This does data copy as pruning will require records in correct partitions
            alter table t1 partition by system_time interval 1 hour
            starts '2000-01-01 00:00:00';
            # But this works fast, LIMIT will apply to DML commands
            alter table t1 partition by system_time limit 33;
            {code}
            midenok Aleksey Midenkov made changes -
            Description When we need to add/remove or change LIMIT, INTERVAL, AUTO (10.8 and more) we have to recreate partitioning from scratch. Such operations should be done fast. To remove options like LIMIT or INTERVAL one should write:

            {code:sql}
            alter table t1 partition by system_time;
            {code}

            The command checks whether it is new or existing SYSTEM_TIME partitioning. And in the case of new it behaves as CREATE would do: adds default number of partitions (2). If SYSTEM_TIME partitioning already existed it just changes its options: removes unspecified ones and adds/changes those specified explicitly. In case when partitions list was supplied it behaves as usual: does full repartitioning.

            Examples:
            {code:sql}
            create or replace table t1 (x int) with system versioning
            partition by system_time limit 100 partitions 4;
            # Change LIMIT
            alter table t1 partition by system_time limit 33;
            # Remove LIMIT
            alter table t1 partition by system_time;
            # This does full repartitioning
            alter table t1 partition by system_time limit 33 partitions 6;
            # This does data copy as pruning will require records in correct partitions
            alter table t1 partition by system_time interval 1 hour
            starts '2000-01-01 00:00:00';
            # But this works fast, LIMIT will apply to DML commands
            alter table t1 partition by system_time limit 33;
            {code}
            When we need to add/remove or change LIMIT, INTERVAL, AUTO (10.8 and more) we have to recreate partitioning from scratch. Such operations should be done fast. To remove options like LIMIT or INTERVAL one should write:

            {code:sql}
            alter table t1 partition by system_time;
            {code}

            The command checks whether it is new or existing SYSTEM_TIME partitioning. And in the case of new it behaves as CREATE would do: adds default number of partitions (2). If SYSTEM_TIME partitioning already existed it just changes its options: removes unspecified ones and adds/changes those specified explicitly. In case when partitions list was supplied it behaves as usual: does full repartitioning.

            Examples:
            {code:sql}
            create or replace table t1 (x int) with system versioning
            partition by system_time limit 100 partitions 4;
            # Change LIMIT
            alter table t1 partition by system_time limit 33;
            # Remove LIMIT
            alter table t1 partition by system_time;
            # This does full repartitioning
            alter table t1 partition by system_time limit 33 partitions 4;
            # This does data copy as pruning will require records in correct partitions
            alter table t1 partition by system_time interval 1 hour
            starts '2000-01-01 00:00:00';
            # But this works fast, LIMIT will apply to DML commands
            alter table t1 partition by system_time limit 33;
            {code}
            midenok Aleksey Midenkov made changes -
            Summary ALTER of SYSTEM_TIME partitioning is not possible without data copy Change of SYSTEM_TIME partitioning options is not possible without data copy
            midenok Aleksey Midenkov made changes -
            Fix Version/s 10.3 [ 22126 ]
            Affects Version/s 10.3 [ 22126 ]
            midenok Aleksey Midenkov added a comment - - edited

            Please review bb-10.5-midenok

            midenok Aleksey Midenkov added a comment - - edited Please review bb-10.5-midenok
            midenok Aleksey Midenkov made changes -
            Assignee Aleksey Midenkov [ midenok ] Nikita Malyavin [ nikitamalyavin ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            midenok Aleksey Midenkov made changes -
            midenok Aleksey Midenkov made changes -
            Affects Version/s 10.3 [ 22126 ]
            Affects Version/s 10.4 [ 22408 ]
            Affects Version/s 10.5 [ 23123 ]
            Affects Version/s 10.6 [ 24028 ]
            Affects Version/s 10.7 [ 24805 ]
            midenok Aleksey Midenkov made changes -
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.7 [ 24805 ]

            Agree about semantics, and approve it.

            For docs team:
            after this ticket is done, ALTER for SYSTEM_TIME partitioning will do
            full repartitioning when:

            • INTERVAL is added or changed;
            • partition list or partition number was specified;

            Otherwise it will do fast alter table.

            For the context and some reasoning, one can also see MDEV-25540 from duplicates.

            cc GeoffMontee jacob.moorman

            nikitamalyavin Nikita Malyavin added a comment - Agree about semantics, and approve it. For docs team: after this ticket is done, ALTER for SYSTEM_TIME partitioning will do full repartitioning when: INTERVAL is added or changed; partition list or partition number was specified; Otherwise it will do fast alter table. For the context and some reasoning, one can also see MDEV-25540 from duplicates. cc GeoffMontee jacob.moorman
            nikitamalyavin Nikita Malyavin made changes -
            Assignee Nikita Malyavin [ nikitamalyavin ] Aleksey Midenkov [ midenok ]
            Status In Review [ 10002 ] Stalled [ 10000 ]

            Actually there was some worry from nikitamalyavin side about the syntax so please confirm the approach. In favour of the approach elenst tried that syntax intuitively in MDEV-25540 and I see no better syntax than that.

            midenok Aleksey Midenkov added a comment - Actually there was some worry from nikitamalyavin side about the syntax so please confirm the approach. In favour of the approach elenst tried that syntax intuitively in MDEV-25540 and I see no better syntax than that.
            midenok Aleksey Midenkov made changes -
            Assignee Aleksey Midenkov [ midenok ] Oleksandr Byelkin [ sanja ]
            Status Stalled [ 10000 ] In Review [ 10002 ]

            As I unterstand AUTO is applicable only for new partitios, so it is OK.

            But how it will behave with LIMIT and old partitions is not clear, could we discuss it?

            sanja Oleksandr Byelkin added a comment - As I unterstand AUTO is applicable only for new partitios, so it is OK. But how it will behave with LIMIT and old partitions is not clear, could we discuss it?
            elenst Elena Stepanova added a comment - - edited

            In favour of the approach Elena Stepanova tried that syntax intuitively in MDEV-25540

            I don't think MDEV-25540 is a suitable justification for this.
            AUTO attribute in MDEV-25540 only affects the process of partitioning – that is, defines how new partitions are created or not created. For already existing ones, it has no meaning and thus its change doesn't anyhow affect them.
            LIMIT and INTERVAL can be seen, at least by users, as attributes of both partitioning (the process) and individual partitions. Some users can reasonably expect that the change will affect existing partitions and distribution of existing data, especially since that's how it already works.

            elenst Elena Stepanova added a comment - - edited In favour of the approach Elena Stepanova tried that syntax intuitively in MDEV-25540 I don't think MDEV-25540 is a suitable justification for this. AUTO attribute in MDEV-25540 only affects the process of partitioning – that is, defines how new partitions are created or not created. For already existing ones, it has no meaning and thus its change doesn't anyhow affect them. LIMIT and INTERVAL can be seen, at least by users, as attributes of both partitioning (the process) and individual partitions . Some users can reasonably expect that the change will affect existing partitions and distribution of existing data, especially since that's how it already works.
            sanja Oleksandr Byelkin made changes -
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.7 [ 24805 ]

            We agreed that server behaviour better to change in the new versions. Also it should be documentated.

            sanja Oleksandr Byelkin added a comment - We agreed that server behaviour better to change in the new versions. Also it should be documentated.
            sanja Oleksandr Byelkin made changes -
            Assignee Oleksandr Byelkin [ sanja ] Aleksey Midenkov [ midenok ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            midenok Aleksey Midenkov made changes -
            Description When we need to add/remove or change LIMIT, INTERVAL, AUTO (10.8 and more) we have to recreate partitioning from scratch. Such operations should be done fast. To remove options like LIMIT or INTERVAL one should write:

            {code:sql}
            alter table t1 partition by system_time;
            {code}

            The command checks whether it is new or existing SYSTEM_TIME partitioning. And in the case of new it behaves as CREATE would do: adds default number of partitions (2). If SYSTEM_TIME partitioning already existed it just changes its options: removes unspecified ones and adds/changes those specified explicitly. In case when partitions list was supplied it behaves as usual: does full repartitioning.

            Examples:
            {code:sql}
            create or replace table t1 (x int) with system versioning
            partition by system_time limit 100 partitions 4;
            # Change LIMIT
            alter table t1 partition by system_time limit 33;
            # Remove LIMIT
            alter table t1 partition by system_time;
            # This does full repartitioning
            alter table t1 partition by system_time limit 33 partitions 4;
            # This does data copy as pruning will require records in correct partitions
            alter table t1 partition by system_time interval 1 hour
            starts '2000-01-01 00:00:00';
            # But this works fast, LIMIT will apply to DML commands
            alter table t1 partition by system_time limit 33;
            {code}
            When we need to add/remove or change LIMIT, INTERVAL, AUTO we have to recreate partitioning from scratch. Such operations should be done fast. To remove options like LIMIT or INTERVAL one should write:

            {code:sql}
            alter table t1 partition by system_time;
            {code}

            The command checks whether it is new or existing SYSTEM_TIME partitioning. And in the case of new it behaves as CREATE would do: adds default number of partitions (2). If SYSTEM_TIME partitioning already existed it just changes its options: removes unspecified ones and adds/changes those specified explicitly. In case when partitions list was supplied it behaves as usual: does full repartitioning.

            Examples:
            {code:sql}
            create or replace table t1 (x int) with system versioning
            partition by system_time limit 100 partitions 4;
            # Change LIMIT
            alter table t1 partition by system_time limit 33;
            # Remove LIMIT
            alter table t1 partition by system_time;
            # This does full repartitioning
            alter table t1 partition by system_time limit 33 partitions 4;
            # This does data copy as pruning will require records in correct partitions
            alter table t1 partition by system_time interval 1 hour
            starts '2000-01-01 00:00:00';
            # But this works fast, LIMIT will apply to DML commands
            alter table t1 partition by system_time limit 33;
            {code}
            midenok Aleksey Midenkov made changes -
            Fix Version/s 10.8.1 [ 26815 ]
            Fix Version/s 10.8 [ 26121 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            midenok Aleksey Midenkov made changes -
            Resolution Fixed [ 1 ]
            Status Closed [ 6 ] Stalled [ 10000 ]

            Please update documenation for SYSTEM_TIME partitioning in 10.8 according to this task.

            midenok Aleksey Midenkov added a comment - Please update documenation for SYSTEM_TIME partitioning in 10.8 according to this task.
            midenok Aleksey Midenkov made changes -
            Assignee Aleksey Midenkov [ midenok ] Geoff Montee [ geoffmontee ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.8 [ 26121 ]
            Fix Version/s 10.8.1 [ 26815 ]

            LIMIT and INTERVAL can be seen, at least by users, as attributes of both partitioning (the process) and individual partitions. Some users can reasonably expect that the change will affect existing partitions and distribution of existing data, especially since that's how it already works.

            This keyword should apply to partitioning only. Individual attributes apply in partitions list.

            midenok Aleksey Midenkov added a comment - LIMIT and INTERVAL can be seen, at least by users, as attributes of both partitioning (the process) and individual partitions. Some users can reasonably expect that the change will affect existing partitions and distribution of existing data, especially since that's how it already works. This keyword should apply to partitioning only. Individual attributes apply in partitions list.
            midenok Aleksey Midenkov made changes -
            Assignee Geoff Montee [ geoffmontee ] Aleksey Midenkov [ midenok ]
            midenok Aleksey Midenkov made changes -
            Fix Version/s 10.9.1 [ 27114 ]
            Fix Version/s 10.8 [ 26121 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]

            julien.fritsch Why you did not automate that on closing the issue?

            midenok Aleksey Midenkov added a comment - julien.fritsch Why you did not automate that on closing the issue?

            People

              midenok Aleksey Midenkov
              midenok Aleksey Midenkov
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.