Tag Database Objects
What is a tag?
A tag is a database-level object that helps users label, classify, and manage other objects in the database. using tags, you can add custom labels to database objects such as databases, users, and tables, making it easier to manage and monitor different objects in the database.
You can use tags in the database mainly used for the following purposes:
Compliance monitoring for sensitive data: Tags can mark sensitive data to help administrators track and protect data, thus ensuring compliance.
Data governance and resource usage management: Tags can classify and label different types of database objects, which helps discover data, protect it, and monitor resource usage.
Tags are stored as key-value pairs, with a tag name and its value making up the pair. You can assign the same tag to multiple database objects with different values for flexible management.
SynxDB supports and enables tags by default, with no extra setup needed.
Usage scenarios
The tag is suitable for these situations:
Object classification: Tags can be used to classify database objects. For example, you can use tags to tell the difference between objects in a development environment and a production environment. This makes it easier to quickly find and manage database objects in different environments.
Permission management: By giving objects-specific tags, you can mark objects with special permissions or sensitive data. This helps administrators be more accurate when checking data, giving permissions, and managing compliance.
Version control and status tracking: Tags can also be used to mark the version or status of database objects. This helps teams track the history of changes or see the database setup at a specific point in time. For example, a tag can show which project stage or version an object belongs to.
Resource usage monitoring: Giving tags to resources (such as warehouses or tables) can help you accurately monitor resource usage. For example, tags can be used to group data warehouses by cost centers or business units, making it easier to analyze how resources are used and their efficiency.
Common errors and tips
Duplicate labels: If a
CREATE <object> ... TAG (...)statement assigns the same tag more than once (for example,TAG ( priority = 'high', priority = 'urgent' )), the database system returns an error. AnALTER <object> ... TAG (...)statement, however, does not error in this case: it keeps the last value in the list.Permission denied: If a non-superuser or non-label owner tries to delete or modify a label, the database system returns a permission error.
Exceeded label limit: An object can have a maximum of 50 labels. Adding more than 50 will cause an error.
Using this feature, database administrators can organize and manage database objects more effectively, making the system more flexible and easier to operate.