Information about OSQL requests in the database.

comdb2_active_osqls(type, origin, argv0, where, cnonce, request_id, nops,
                    start_time, commit_time, nretries)
  • type - “OSQL” for active osql streams and “BPLOG” for active block processors.
  • origin - Where the request is from
  • argv0 - Program that generates this request
  • where - Stack trace of this request
  • cnonce - cnonce (client nonce) of this request
  • request_id - UUID of this request
  • nops - Number of OSQL operations
  • start_time - Time when this request is created
  • commit_time - Commit time of this request
  • nretries - Number of retries


Lists all available APPSOCK handlers.

comdb2_appsock_handlers(name, usage, exec_count)

  • name - Name of the APPSOCK handler
  • usage - Usage information
  • exec_count - Execution count


Lists auto analyze info about each table. NOTE: save_freq must be > 0 to use this table on a replicant. For most up to date info query on leader node.

comdb2_auto_analyze_tables(tablename, counter, saved, new, percent_of_tbl, last_run_time, needs_analyze_time)
  • tablename - Name of the table
  • counter - Current number of operations
  • saved - Saved number of operations
  • new - Difference between counter and saved
  • percent_of_tbl - Percent of table that has been modified since last analyze
  • last_run_time - Last run time of analyze, or NULL if never ran
  • needs_analyze_time - The first time since it was last run that it was determined that a table needs to be analyzed (only in request mode), NULL if analyze not needed


Information about BLKSEQ stored in the database. (TODO: Explain BLKSEQ)

comdb2_blkseq(stripe, index, id, size, rcode, time, age)
  • stripe - Stripe of a BLKSEQ file
  • index - Index of a BLKSEQ file
  • id - Identifier of the request
  • size - Size of the BLKSEQ entry
  • rcode - Return code of this request
  • time - Epoch time when this BLKSEQ was added
  • age - Time in seconds since the BLKSEQ was added


Lists statistics about clients.

comdb2_clientstats(task, stack, host, ip, finds, rngexts, writes,
                   other_fstsnds, adds, upds, dels, bsql, recom,
                   snapisol, serial, sql_queries, sql_steps, sql_rows,
  • task - Name of the client program
  • stack - Stack of the client program
  • host - Client host name
  • ip - Client IP address
  • finds - obsolete
  • rngexts - obsolete
  • writes - obsolete
  • other_fstsnds - obsolete
  • adds - obsolete
  • upds - obsolete
  • dels - obsolete
  • bsql - obsolete
  • recom - obsolte
  • snapisol - obsolete
  • serial - obsolete
  • sql_queries - Total number of SQL queries executed
  • sql_steps - Total number of steps (basic internal operations) executed
  • sql_rows - Total number of rows returned
  • svc_time - Total time taken to execute queries (in milliseconds)


Information about nodes in the cluster.

comdb2_cluster(host, port, is_master, coherent_state)
  • host - Host name of the node
  • port - Port number of the node
  • is_master - Is the node master?
  • coherent_state - Is the node coherent?


Describes all the columns for all of the tables in the database.

comdb2_columns(tablename, columnnname, type, size, sqltype,
varinlinesize, defaultvalue, dbload, isnullable, lastsequence)
  • tablename - Name of the table
  • columnname - Name of the column
  • size - The storage size of the column
  • sqltype - The type as recognized by SQL
  • varinlinesize - The size of the data stored in the column when inlined
  • defaultvalue - The default value for this column
  • dbload - obsolete
  • isnullable - Y if this column can hold nulls
  • lastsequence - Largest value the column has held (for autoincrement)


This table lists all keywords & identifiers based on the current state of the database. cdb2sql uses it to provide auto-completion feature.

  • candidate - keywords/identifiers


Shows all foreign key constraints on tables in the database.

comdb2_constraints(tablename, keyname, foreigntablename,
foreignkeyname, iscascadingdelete, iscascadingupdate)
  • tablename - Name of the table
  • keyname - Name of the key
  • foreigntablename - Name of the foreign table
  • foreignkeyname - Name of the foreign key
  • iscascadingdelete - Y if this is a cascading delete
  • iscascadingupdate - Y if this is a cascading update


Information about events queued in all the schedulers running.

comdb2_cron_events(name, type, epoch, arg1, arg2, arg3, sourceid)
  • name - Name of the event
  • type - Type of the scheduler
  • epoch - Unix time when the event is intended to run
  • arg1 - First argument for the event, usually the shard table name involved
  • arg2 - Generic second argument for the event
  • arg3 - Generic third argument for the event
  • sourceid - UUID identifying the client generating the event, if any


Information about schedulers running.

comdb2_cron_schedulers(name, type, running, nevents, description)
  • name - Name of the scheduler
  • type - Type of the scheduler, as “WALLTIME” for a time cron
  • running - Set to 1 if the scheduler is running an event at this time, 0 otherwise
  • nevents - How many events are queued in this scheduler?
  • description - Details the purpose of the scheduler; for example, there is a time partition scheduler, or a memory modules stat scheduler


The cached remote schemas used for distributed sql execution.

comdb2_fdb_info(dbname, location, tablename, indexname, rootpage, remoterootpage, version)
  • dbname - Name of the remote database that executes a subset of sql
  • location - Name of the remote database class, ‘LOCAL’, ‘DEV’, ‘ALPHA’, ‘BETA’, ‘PROD’
  • tablename - Name of the remote table (NOTE: we cache schemas only for accessed tables)
  • indexname - Name of the index, if this is an index entry, NULL otherwise
  • `rootpage - Value of the local rootpage sqlite uses to refer to remote table/index
  • remoterootpage - Value of the remote rootpage
  • version - Schema version of the remote table; used to pull new schema on access


The functions available to call from sql.

  • name - Name of the function


Describes all the components of the keys.

comdb2_keycomponents(tablename, keyname, columnnumber, columnname,
  • tablename - Name of the table
  • keyname - Name of the key
  • columnnumber - Position of columnname in keyname
  • columnname - Name of a column in keyname
  • isdescending - Y if this column is descending


Describes all of the keys in the database.

comdb2_keys(tablename, keyname, keynumber, isunique, isdatacopy,
isrecnum, condition, ispartialdatacopy)
  • tablename - Name of the table
  • keyname - Name of the key
  • isunique - Y if this key is unique
  • isdatacopy - Y if the data is inlined with this key
  • isrecnum - Y if this key has recnums
  • condition - Where condition for this index
  • uniqnulls - Y if this key treats NULL values as unique
  • ispartialdatacopy - Y if some subset of the data is inlined with this key


Describes all the keywords used in the database. A reserved keyword needs to be quoted when used as an identifier.

comdb2_keywords(name, reserved)
  • name - Name of the keyword
  • reserved - ‘Y’ if the keyword is reserved, ‘N’ otherwise


Describes all the hard limits in the database.

comdb2_limits(name, description, value)
  • name - Name of the limit
  • description - Description of the limit
  • value - Value of the limit


Lists all active comdb2 locks.

comdb2_locks(thread, lockerid, mode, status, object, locktype, page)

  • thread - Thread Id of the owner thread
  • lockerid - Locker Id
  • object - Locked object
  • page - Page number


Lists all logical operations

comdb2_logical_operations(commitlsn, opnum, operation, tablename, oldgenid,
                          oldrecord, genid, record)
  • commitlsn - Log sequence number
  • opnum - Index of operation within a transaction
  • operation - Type of logical operation
  • tablename - Table name
  • oldgenid - Old record’s generation Id
  • oldrecord - Old record
  • genid - New record’s generation Id
  • record - New record


Shows various operational and performance metrics.

comdb2_metrics(name, description, type, value, collection_type)
  • name - Name of the metrics
  • description - Description
  • type - Type of the metrics
  • value - Value
  • collection_type - Is value cumulative or latest? A cumulative metric is a cumulative sum over the time; A latest metric is a instantaneous measurement.


Statistics about network packets sent across cluster nodes.

comdb2_net_userfuncs(service, userfunc, count, totalus)
  • service - Class of network packet
  • userfunc - Network packet type (handler/user function)
  • count - Total number of invocations of this user function
  • totalus - Total execution time of this user function (in microseconds)


Lists all opcode handlers available in Comdb2.

comdb2_opcode_handlers(opcode, name)
  • opcode - Number assigned to the opcode handler
  • name - Name of the opcode handler


Lists all of the partial datacopy columns for each relevant key in the database.

comdb2_partial_datacopies(tablename, keyname, columnname)
  • tablename - Name of the table with partial datacopy
  • keyname - Name of the key with partial datacopy
  • columnname - Name of the column included in partial datacopy for keyname


Lists all plugins currently available in Comdb2.

comdb2_plugins(name, description, type, version, is_static)
  • name - Name of the plugin
  • description - Description
  • type - Type of plugin
  • version - Plugin version
  • is_static - Is plugin static or dynamic?


List all stored procedures in the database.

comdb2_procedures(name, version, client_versioned, default, src)
  • name - Name of the stored procedure
  • version - Stored procedure version
  • client_versioned - Is client versioned?
  • default - Is default?
  • src - Source


List all query plans for each fingerprint/query in the database.

comdb2_query_plans(fingerprint, normalized_sql, plan, total_cost_per_row, num_executions, avg_cost_per_row)
  • fingerprint - Fingerprint of the query
  • normalized_sql - Query associated with the fingerprint
  • plan - Query plan for this fingerprint that includes the tables and indices traversed
  • total_cost_per_row - The sum of all of the cost per rows (in results set) each time this query plan is executed for this query
  • num_executions - The number of times this query plan is executed for this query
  • avg_cost_per_row - Average cost per row (in results set), calculated by total_cost_per_row / num_executions


List all queues in the database.

comdb2_queues(queuename, spname, head_age, depth, total_enqueued, total_dequeued)
  • queuename - Name of the queue
  • spname - Stored procedure attached to the queue
  • head_age - Age of the head element in the queue
  • depth - Number of elements in the queue
  • total_enqueued - Total number of elements added since process start
  • total_dequeued - Total number of elements removed since process start


Replication statistics.

comdb2_repl_stats(host, bytes_written, bytes_read, throttle_waits, reorders,
                  avg_wait_over_10secs, max_wait_over_10secs,
                  avg_wait_over_1min,  max_wait_over_1min)
  • host - Host name
  • bytes_written - Number of bytes written
  • bytes_read - Number of bytes read
  • throttle_waits - Number of throttle waits
  • reorders - Number of reorders (see enque_reorder_lookahead under Network configurations)
  • avg_wait_over_10secs - Average of waits over 10 seconds
  • max_wait_over_10secs - Maximum of waits over 10 seconds
  • avg_wait_over_1min - Average of waits over a minute
  • max_wait_over_1min - Maximum of waits over a minute


This table lists the current state of the replication network queue per node.

comdb2_replication_netqueue(machine, total, min_lsn, max_lsn, alive,
                            alive_req, all_req, dupmaster, file, file_req,
                            log, log_more, log_req, master_req, newclient,
                            newfile, newmaster, newsite, page, page_req,
                            plist, plist_req, verify, verify_fail,
                            verify_req, vote1, vote2, log_logput,
                            pgdump_req, gen_vote1, gen_vote2, log_fill,
                            uncategorized, unknown)
  • machine - Host name of the node
  • total - Number of total messages
  • min_lsn - Minimum LSN in the queue
  • max_lsn - Maximum LSN in the queue
  • alive - Number of ‘I am alive’ messages
  • alive_req - Number of requests for an alive message
  • all_req - Number of requests for all log records greater than LSN
  • dupmaster - Number of ‘Duplicate master detected’ messages
  • file - Number of ‘page of a database file’ messages
  • file_req - Number of requests for a database file
  • log - Number of log record messages
  • log_more - Number of ‘more log records to request’ messages
  • log_req - Number of requests for a log record
  • master_req - Number of ‘Who is the master’ messages
  • newclient - Number of ‘presence of new clients’ announcements
  • newfile - Number of ‘log file change’ announcements
  • newmaster - Number of ‘who the master is’ announcements
  • newsite - Number of ‘heard from a new site’ announcements
  • page - Number of ‘database page’ messages
  • page_req - Number of requests for a database page
  • plist - Number of ‘database page list’ messages
  • plist_req - Number of requests for a page list
  • verify - Number of ‘verification log record’ messages
  • verify_fail - Number of ‘client is outdated’ messages
  • verify_req - Number of requests for a log record to verify
  • vote1 - Number of ‘basic information for election’ messages
  • vote2 - Number of ‘you are master’ messages
  • log_logput - Master internal, same as log
  • pgdump_req - Number of requests to dump a page for a given file Id (for debugging)
  • gen_vote1 - Same as vote1 (also contains the generation number)
  • gen_vote2 - Same as vote2 (also contains the generation number)
  • log_fill - Number of log_fill messages
  • uncategorized - Number of ‘uncategorized’ messages
  • unknown - Number of ‘unknown’ messages


Information about SQL query pool status.

comdb2_sqlpool_queue(time_in_queue_ms, sql)
  • time_in_queue_ms - Total time spent in queue (in milliseconds)
  • sql - SQL query


List all available system tables in Comdb2.

  • name - Name of the system table


Table of permissions for system tables in the database.

comdb2_systablepermissions(tablename, username, READ, WRITE, DDL)
  • tablename - Name of the system table
  • username - Name of the user
  • READ - Y if username has read access to tablename
  • WRITE - Y if username has write access to tablename
  • DDL - Y if username can modify tablename schema


This table lists miscellaneous table properties

comdb2_table_properties(table_name, odh, compress, blob_compress, 
in_place_updates, instant_schema_change)
  • table_name - Name of the table
  • odh - Y if on disk headers are enabled
  • compress - Type of compression used
  • blob_compress - Type of blob compression used
  • in_place_updates - Y if in-place updates are enabled
  • instant_schema_change - Y if instant schema change is enabled


Table of permissions for tables in the database.

comdb2_tablepermissions(tablename, username, READ, WRITE, DDL)
  • tablename - Name of the table
  • username - Name of the user
  • READ - Y if username has read access to tablename
  • WRITE - Y if username has write access to tablename
  • DDL - Y if username can modify tablename schema


This is a table of all the existing tables in the database.

  • tablename - Name of the table


Shows the sizes on disk of the tables.

comdb2_tablesizes(tablename, bytes)
  • tablename - Name of the table
  • bytes - Size of the table in bytes


Shows the columns for each schema tag

comdb2_tag_columns(tablename, tagname, name, indx, type, offset,
                   length, datalength, flags, expr, defaultvalue,
                   dbload, conversionflags, conversiondbpad,
                   conversionstep, blobindx)
  • tablename - Name of the table
  • tagname - Name of the tag
  • name - Name of the column
  • indx - Index of the column in the tag
  • type - Type of the column
  • offset - Offset of the column in the tag
  • length - Bytes length of the column in the tag
  • datalength - For dyntags, length of the client supplied buffer
  • flags - Flags for column INDEX_DESCENT = 1 set for index members, to reverse order NO_NULL = 2 do not allow nulls
  • expr - Set if the column is an expression
  • defaultvalue - Dbstore default value for a column
  • dbload - Dbload value for a column
  • conversionflags - Flags the alter the conversion FLD_CONV_DBPAD - special byte array handling FLD_CONV_TZONE - timezone is specifed FLD_CONV_LENDIAN - column is little endian FLD_CONV_TRUNCATE - special handling for out of range strings
  • conversiondbpad - For byte arrays. Converting from - if the destination is smaller, the lost bytes must match dbpad or it is a conversion failure. Converting to - if the destination is larger then the spare bytes will be padded with dbpad. If dbapd==-1 then the source and destination must match.
  • conversionstep - Applies to out of range strings 0 for truncate only 1 for truncate and increment
  • blobindex - If the column is a blob, its index, otherwise -1


Shows the schema tags for tables

comdb2_tags(tablename, tagname, ixnum, size, columns, sqlitetag, csctag,
            numblobs, numindexes)
  • tablename - Name of the table
  • tagname - Name of the tag
  • ixnum - If this is a schema index, its index in the list of indexes
  • size - Length of the index (recsize)
  • numcolumns - Number of columns in the tag
  • sqlitekeyname - If this is a schema index, the name that sqlite uses for it
  • keyname - If this is an index, name of the index
  • numblobs - Number of blob columns in the tag
  • numndexes - If this is a table tag schema, how many indexes


Reports sizes of temporary files.

comdb2_temporary_file_sizes(type, bytes)
  • type - Temporary file type. Can be one of temptables, sqlsorters, blkseqs and others
  • bytes - Size in bytes


Information about thread pools in the database.

comdb2_threadpools(name, status, num_thd, free_thd, peak_thd, num_creates,
                   num_exits, num_passed, num_enqueued, num_dequeued,
                   num_timeout, num_failed_dispatches, min_thds, max_thds,
                   peak_queue, max_queue, queue, long_wait_ms,
                   linger_secs, stack_size, max_queue_override,
                   max_queue_age_ms, exit_on_create_fail, dump_on_full)
  • name - Name of the thread pool
  • status - Status of the thread pool
  • num_thd - Total number of threads
  • free_thd - Number of free threads
  • peak_thd - Peak number of threads
  • num_creates - Total number of thread created
  • num_exits - Total number of threads exited
  • num_passed - Work items done immediately
  • num_enqueued - Number of work items enqueued
  • num_dequeued - Number of work items dequeued
  • num_timeout - Number of work items timed-out
  • num_failed_dispatches - Number of failed dispatches
  • min_thds - Desired number of threads
  • max_thds - Maximum number of threads
  • peak_queue - Work queue peak size
  • max_queue - Work queue maximum size
  • queue - Work queue current size
  • long_wait_ms - Long wait alarm threshold
  • linger_secs - Thread linger time
  • stack_size - Thread stack size
  • max_queue_override - Maximum queue override
  • max_queue_age_ms - Maximum queue age
  • exit_on_create_fail - If ‘Y’, exit on failure to create thread
  • dump_on_full - If ‘Y’, dump on queue full


Information about time partition events in the dedicated cron scheduler (alias for filtered comdb2_cron_events system table).

comdb2_timepartevents(name, type, arg1, arg2, arg3, sourceid)
  • name - Name of the event (AddShard RollShard DropShard)
  • type - Type of the scheduler, here defaults to “timepart_sched”
  • arg1 - First argument for the event, usually the shard table name involved
  • arg2 - Generic second argument for the event
  • arg3 - Generic third argument for the event
  • sourceid - UUID identifying the partition generating the event, if any


Information about time partitions.

comdb2_timepartitions(name, period, retention, nshards, version, shard0name, starttime, sourceid)
  • name - Name of the time partition
  • period - How often this partition rolls out? (DAILY WEEKLY MONTHTLY YEARLY)
  • retention - How many shards are preserved; older gets removed when retention is reached
  • nshards - How many shards are already present, which is retention for fully grown time partitions
  • version - Schema change version, matching the version of underlying tables
  • shard0name - Name of the initial table used to seed the time partition
  • start - “epoch” seconds when the first rollout happens/happened
  • sourceid - UUID identifying the partition


Table of permissions for time partitions in the database.

comdb2_timepartpermissions(tablename, username, READ, WRITE, DDL)
  • tablename - Name of the time partition
  • username - Name of the user
  • READ - Y if username has read access to tablename
  • WRITE - Y if username has write access to tablename
  • DDL - Y if username can modify tablename schema


Information about time partition shards.

comdb2_timepartshards(name, shardname, start, end)
  • name - Name of the time partition
  • shardname - Name of the underlying shard table
  • start - Minimum “epoch” seconds for the shard; all rows in it were inserted after this time
  • end - Maximum “epoch” seconds for the shard; all rows in it were inserted before this time


This table lists various metrics.

comdb2_timeseries(metric, time, value)
  • metric - Name of the metric
  • time - Timestamp
  • value - Value


Lists all the transaction log records.

comdb2_transaction_logs(lsn, rectype, generation, timestamp, payload)
  • lsn - Log sequence number
  • rectype - Record type
  • generation - Generation ID
  • timestamp - Timestamp
  • payload - Paylod


Lists the state of all threads processing transactions.

comdb2_transaction_state(state, time, machine, opcode, function)
  • state - Thread state (‘busy’ or ‘idle’)
  • time - The amount of time (ms) that the thread has been processing this request
  • machine - The ID of the machine that the thread is running on
  • opcode - The opcode that the thread is processing
  • function - The backend function that the thread is running


Lists triggers in the database.

comdb2_triggers(name, type, tbl_name, event, col, seq)
  • name - Name of the trigger
  • type - Type of the trigger
  • tbl_name - Name of the table
  • event - Event to trigger on
  • col - Column to trigger on
  • seq - ‘Y’ if sequences are enabled, ‘N’ otherwise


Describes all the knobs in the database.

comdb2_tunables(name, description, type, value, read_only)
  • name - Name of the tunable
  • description - Description of the tunable
  • type - Type of the tunable
  • value - Current value of the tunable
  • read_only - ‘Y’ if the tunable is READ-ONLY, ‘N’ otherwise


Describes the sample values of all the data types supported by Comdb2.

comdb2_type_samples(integer, real, cstring, blob, datetime, intervalym,
                    intervalds, datetimeus, intervaldsus)
  • integer - Sample value of ‘integer’ type
  • real - Sample value of ‘real’ type
  • cstring - Sample value of ‘cstring’ type
  • blob - Sample value of ‘blob’ type
  • datetime - Sample value of ‘datetime’ type
  • intervalym - Sample value of ‘intervalym’ type
  • intervalds - Sample value of ‘intervalds’ type
  • datetimeus - Sample value of ‘datetimeus’ type
  • intervaldsus - Sample value of ‘intervaldsus’ type


Table of users for the database that do or do not have operator access.

comdb2_users(username, isOP)
  • username - Name of the user
  • isOP - ‘Y’ if ‘username’ has operator access


System table containing history of the schemachanges done in the database.

comdb2_sc_history(name, start, status, seed, last_updated,
                  converted, error)
  • name - Name of the table.
  • start - Start time of the schema change.
  • status - Last/Final status of the schema change.
  • seed - Seed (ID) of schema change
  • last_updated - Time of the last status change.
  • converted - Number of records converted.
  • error - Error message of the schema change.


Information about current/most recent schema change per table.

comdb2_sc_status(name, type, newcsc2, start, status, seed, last_updated,
                 converted, error)
  • name - Name of the table.
  • type - Type of the schema change.
  • newcsc2 - New schema in csc2 format.
  • start - Start time of the schema change.
  • status - Current status of the schema change.
  • seed - Seed (ID) of schema change running for this table (NULL if not currently running).
  • last_updated - Time of the last status change.
  • converted - Number of records converted.
  • error - Error message of the schema change.


List of all versions of table schemas stored in llmeta.

comdb2_schemaversions(name, csc2, version)
  • tablename - Name of the table.
  • csc2 - Schema in csc2 format.
  • version - Numeric version associated with this schema version in llmeta.


List of views in the database.

comdb2_views(name, definition)
  • name - Name of the view
  • definition - View definition


Heap memory usage

comdb2_memstats(name, scope, total, used, unused, peak)
  • name - name of the allocator.
  • scope - thread type of the allocator.
  • total - total number of bytes (used + unused) in the allocator
  • used - number of used bytes in the allocator
  • unused - number of unused bytes in the allocator
  • peak - maximum number of bytes used by the allocator since it was created


Generic stack collection

comdb2_stacks(id, hits, stack)
  • id - index of this stack.
  • hits - number of times this stack has been collected.
  • stack - flattened stack.


Active string references

comdb2_stringrefs(string, func, line, refcnt, stack)

  • string - stringref string value.
  • func - function which allocated the string.
  • line - line number which allocates the string.
  • refcnt - number of active references.
  • stack - stack which allocated string.