Meta functions

These functions provide table information including column details and metadata. These functions are particularly useful for checking if tables contain a designated timestamp column.

table_columns#

table_columns('tableName') returns the schema of a table

Arguments:

  • tableName is the name of an existing table as a string

Return value:

Returns a table with the following columns:

  • column - name of the available columns in the table
  • type - type of the column
  • indexed - if indexing is applied to this column
  • indexBlockCapacity - how many row IDs to store in a single storage block on disk
  • symbolCached - whether this symbol column is cached
  • symbolCapacity - how many distinct values this column of symbol type is expected to have
  • designated - if this is set as the designated timestamp column for this table

For more details on the meaning and use of these values, see the CREATE TABLE documentation.

Examples:

Get all columns in a table
table_columns('my_table')
columntypeindexedindexBlockCapacitysymbolCachedsymbolCapacitydesignated
symbSYMBOLtrue1048576false256false
priceDOUBLEfalse0false0false
tsTIMESTAMPfalse0false0true
sSTRINGfalse0false0false
Get designated timestamp column
SELECT column, type, designated FROM table_columns('my_table') WHERE designated
columntypedesignated
tsTIMESTAMPtrue
Get the count of column types
SELECT type, count() FROM table_columns('my_table');
typecount
SYMBOL1
DOUBLE1
TIMESTAMP1
STRING1

tables#

tables() returns all tables in the database including table metadata.

Arguments:

  • tables() does not require arguments.

Return value:

Returns a table.

Examples:

List all tables
tables();
idnamedesignatedTimestamppartitionBymaxUncommittedRowso3MaxLagwalEnableddirectoryName
1my_tabletsDAY50000030000000 0falsemy_table
2device_datanullNONE1000030000000falsedevice_data
3short_livednullHOUR1000030000000falseshort_lived (->)
All tables in reverse alphabetical order
tables() ORDER BY name DESC;
idnamedesignatedTimestamppartitionBymaxUncommittedRowso3MaxLagwalEnableddirectoryName
2device_datanullNONE1000030000000falsedevice_data
1my_tabletsDAY500000300000000falsemy_table
3short_livedtsHOUR1000030000000falseshort_lived (->)
note

(->) means the table was created using the IN VOLUME clause.

All tables with a daily partitioning strategy
tables() WHERE partitionBy = 'DAY'
idnamedesignatedTimestamppartitionBymaxUncommittedRowswalEnableddirectoryName
1my_tabletsDAY500000truemy_table

wal_tables#

wal_tables() returns the WAL status for all WAL tables in the database.

Arguments:

  • wal_tables() does not require arguments.

Return value:

Returns a table including the following information:

  • name - table name
  • suspended - suspended status flag
  • writerTxn - the last committed transaction in TableWriter
  • sequencerTxn - the last committed transaction in the sequencer

Examples:

List all tables
wal_tables();
namesuspendedwriterTxnsequencerTxn
sensor_walfalse24
weather_walfalse33
test_waltrue79