Skip to content

16.3.1 Metadata Table Dictionary

Metadata tables use the M$ prefix and expose Machbase schema information, including table definitions, columns, indexes, and users. They are read-only and automatically reflect DDL operations.

In 8.7.0 Standard Edition with multiple databases, joins between catalog-local metadata must use DATABASE_ID, TABLESPACE_ID, and the parent object ID together. Logical DATABASE_ID and physical TABLESPACE_ID are not interchangeable. For database operation boundaries, see the Multiple Database Operations Guide.

Metadata Tables

TableDescription
M$SYS_TABLESUser-created tables and their types
M$SYS_TABLE_PROPERTYProperties applied to tables
M$SYS_COLUMNSTable column definitions (type, length, and other attributes)
M$SYS_INDEXESIndex definitions
M$SYS_INDEX_COLUMNSColumns that make up each index
M$SYS_TABLESPACESTablespaces
M$SYS_TABLESPACE_DISKSDisk paths used by tablespaces
M$SYS_USERSRegistered users
M$SYS_VIEWSSQL text defining views
M$SYS_USER_ACCESSUser privileges per table
M$RETENTIONRetention policy information
M$TABLESThe M$ metadata tables themselves
M$COLUMNSColumns of M$ metadata tables

M$SYS_TABLES

Lists user-created tables and their types.

ColumnTypeDescription
NAMEVARCHARTable name
TYPEINTEGERTable type
IDLONGTable identifier
DATABASE_IDLONGLogical database identifier
TABLESPACE_IDLONGPhysical tablespace identifier
USER_IDINTEGERIdentifier of the user who created the table
COLCOUNTINTEGERNumber of columns
FLAGINTEGERSubtype (1: Tag Data, 2: Rollup, 4: Tag Meta, 8: Tag Stat)

TYPE values:

ValueTable Type
0Log table
1Fixed table
3Volatile table
4Lookup table
5Key Value table
6Tag table
7View
8TRANSACTION table

M$SYS_COLUMNS

Lists table column definitions.

ColumnTypeDescription
NAMEVARCHARColumn name
TYPEINTEGERColumn data type
TABLE_IDLONGParent table identifier
DATABASE_IDLONGLogical database identifier
TABLESPACE_IDLONGPhysical tablespace identifier
LENGTHINTEGERMaximum column length
PART_PAGE_COUNTINTEGERPages per partition
MINMAX_CACHE_SIZELONGMIN-MAX cache size

M$SYS_INDEXES

Lists index definitions.

ColumnTypeDescription
NAMEVARCHARIndex name
TYPEINTEGERIndex type
TABLE_IDLONGParent table identifier
DATABASE_IDLONGLogical database identifier
TABLESPACE_IDLONGPhysical tablespace identifier
COLCOUNTINTEGERNumber of index columns
MAX_LEVELINTEGERMaximum LSM level

M$SYS_USERS

Lists registered users.

ColumnTypeDescription
USER_IDINTEGERUser identifier
NAMEVARCHARUsername
PWD_POLICY_LEVELINTEGERPassword policy level
VALID_BEFOREVARCHARAccount validity period

M$RETENTION

Lists retention policy information.

ColumnTypeDescription
POLICY_NAMEVARCHARPolicy name
DURATIONLONGRetention period in seconds
INTERVALLONGDeletion interval in seconds

SQL Examples

-- List all tables, including their types
SELECT name, type, colcount
  FROM m$sys_tables
 ORDER BY name;

-- List Tag tables only (type = 6)
SELECT name FROM m$sys_tables WHERE type = 6;

-- List columns of a specific table
SELECT c.name AS col_name, c.type AS col_type, c.length
  FROM m$sys_columns c
  JOIN m$sys_tables  t
    ON c.database_id = t.database_id
   AND c.tablespace_id = t.tablespace_id
   AND c.table_id = t.id
 WHERE t.name = 'SENSOR_TAG'
 ORDER BY c.id;

-- List indexes of a specific table
SELECT i.name AS idx_name, i.type AS idx_type, i.colcount
  FROM m$sys_indexes i
  JOIN m$sys_tables  t
    ON i.database_id = t.database_id
   AND i.tablespace_id = t.tablespace_id
   AND i.table_id = t.id
 WHERE t.name = 'SENSOR_TAG';

-- Check the columns that make up an index
SELECT ic.name AS col_name, ic.index_type
  FROM m$sys_index_columns ic
  JOIN m$sys_indexes i ON ic.index_id = i.id
  JOIN m$sys_tables  t ON i.table_id = t.id
 WHERE t.name = 'SENSOR_TAG';

-- Check tablespace disk paths
SELECT ts.name AS tbs_name, d.path, d.io_thread_count
  FROM m$sys_tablespace_disks d
  JOIN m$sys_tablespaces ts ON d.tablespace_id = ts.id;

-- List users
SELECT user_id, name, pwd_policy_level, valid_before
  FROM m$sys_users;

-- List retention policies
SELECT * FROM m$retention;

Metadata tables are read-only. INSERT, UPDATE, and DELETE return errors. Use DDL such as CREATE TABLE, ALTER TABLE, and DROP TABLE to change schemas.

Last updated on