[MDEV-8620] PARTITION() function Created: 2015-08-14  Updated: 2017-05-30

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Minor
Reporter: Federico Razzoli Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: None


 Description   

Can you implement a function (or any other syntax, if a function is not appropriated) returning the name of a partition/subpartition containing a PK entry? For example:

SELECT PARTITION(id) FROM user WHERE id = 98765;

Why am I asking this? Consider RANGE [COLUMNS] and LIST [COKUMNS] partitioning. The name of the (sub)partition is often a useful information. Of course, if we select the columns involved in the partitioning expression, we can calculate this information; but having the information pre-calculated by MariaDB could be more efficient, and more convenient. It could even allow to hide the DB complexity to developers.

(Apache Cassandra has even Static Columns, that is, a single value can be assigned to all rows in a given partition. But it seems to me unnecessarily complicated)



 Comments   
Comment by roberto spadim [ 2015-08-14 ]

i think this could be developed with a UDF, but i don't know how could more than one column be used, something like:
partition_name( schema name, table name, column1, value1, column2, value2, ...... , column<n>, value<n>)

Generated at Thu Feb 08 07:28:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.