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

Partition number pseudo column or function

    XMLWordPrintable

Details

    • New Feature
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • Partitioning
    • None

    Description

      Implement a way to expose the partition number and partition name in which a given row resides, for partitioned tables in MariaDB. This functionality should behave similarly to IBM Db2’s DBPARTITIONNUM() scalar function, and can be realized either as:

      • a pseudo‑column (e.g., _partitionid) that can be selected alongside regular columns, or
      • a scalar function (e.g., DBPARTITIONNUM() or PARTITION_NUM()) that takes no arguments and returns the partition number for each row in the current rowset.

      Why this is important:

      • Partition‑aware applications often need to know which partition a row belongs to for auditing, debugging, or routing decisions (e.g., statistics, cleanup, or distributed‑style queries).
      • Having a built‑in partition‑number pseudo‑column or function avoids the need for users to reverse‑engineer partitioning logic from metadata views, which is fragile and error‑prone.
      • Such a feature improves usability of partitioning in MariaDB and brings it closer to DBMS that already expose partition numbers in a first‑class way (Db2, OceanBase, BigQuery for date‑based partitions).

      The implementation should cover all partition and subpartition types supported by MariaDB and be exposed consistently in SELECT lists, including in WHERE and ORDER BY clauses where applicable.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:

                Git Integration

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