api/db/<db_name>/stat ResourceThe
api/db/<db_name>/statresource displays database statistics for the specified database.For an overview see page eXtremeDB Web Service Resources
In order to enable access to the eXtremeDB Web Services, the REST server must be started. When using xSQL to start the REST server, the
restsection must appear in the configuration file. For example:database_name : xsqldb, database_size : 100m, perfmon : { database_size : 64m }, rest : { port : 8083 }(Note that here the
perfmonsection indicates that the eXtremeDB Performance Monitor is to be enabled, and the rest parameteraddris omitted which allows the REST server to accept incoming connections on all available network interfaces. See page xSQL Web Services REST Parameters for further information).With the REST server started (listening on port 8083) for this xSQL configuration, the
request would display the following:dbresource{ "databases": [ "xsqldb", "eXDB_perf" ] }To view the database statistics for the
eXDB_perfdatabase, the following http requesthttp://localhost:8083/api/db/eXDB_perf/statwould display the following:
{ "mem": { "free_pages": 499728, "total_pages": 522689, "page_size": 128 }, "classes": [ { "table_name": "Node", "objects_num": 0, "versions_num": 0, "core_pages": 0, "blob_pages": 0, "seq_pages": 0, "core_space": 0, "indexes": [ { "type": 128, "type_s": [ "MCO_IDXST_TYPE_MEM", "MCO_IDXST_NATURE_BTREE", "MCO_IDXST_FEATURE_OPTIMIZED", "MCO_IDXST_FUNCTION_REGULAR" [ "plabel": "Node.no_idx", "keys_num": 0, "pages_num": 1, "avg_cmp": 1, "max_cmp": 1, "btree": { "levels_num": 0, "duplicates_num": 0 } } ] }, { "table_name": "eXDBDatabase", "objects_num": 1, "versions_num": 1, "core_pages": 1, "blob_pages": 0, "seq_pages": 0, "core_space": 128, "indexes": [ { "type": 128, "type_s": [ "MCO_IDXST_TYPE_MEM", "MCO_IDXST_NATURE_BTREE", "MCO_IDXST_FEATURE_OPTIMIZED", "MCO_IDXST_FUNCTION_REGULAR" [ "plabel": "eXDBDatabase.no_idx", "keys_num": 1, "pages_num": 1, "avg_cmp": 1, "max_cmp": 1, "btree": { "levels_num": 0, "duplicates_num": 0 } } ] }, { "table_name": "PerfCounter", "objects_num": 33, "versions_num": 33, "core_pages": 33, "blob_pages": 0, "seq_pages": 0, "core_space": 4224, "indexes": [ { "type": 144, "type_s": [ "MCO_IDXST_TYPE_MEM", "MCO_IDXST_NATURE_BTREE", "MCO_IDXST_FEATURE_UNIQUE", "MCO_IDXST_FEATURE_OPTIMIZED", "MCO_IDXST_FUNCTION_REGULAR" [ "plabel": "PerfCounter.no_idx", "keys_num": 33, "pages_num": 4, "avg_cmp": 2, "max_cmp": 2, "btree": { "levels_num": 1, "duplicates_num": 0 } } ] }, { "table_name": "PerfReading", "objects_num": 270, "versions_num": 270, "core_pages": 540, "blob_pages": 0, "seq_pages": 0, "core_space": 69120, "indexes": [ { "type": 128, "type_s": [ "MCO_IDXST_TYPE_MEM", "MCO_IDXST_NATURE_BTREE", "MCO_IDXST_FEATURE_OPTIMIZED", "MCO_IDXST_FUNCTION_REGULAR" [ "plabel": "PerfReading.rec_idx", "keys_num": 270, "pages_num": 23, "avg_cmp": 3, "max_cmp": 3, "btree": { "levels_num": 2, "duplicates_num": 0 } }, { "type": 128, "type_s": [ "MCO_IDXST_TYPE_MEM", "MCO_IDXST_NATURE_BTREE", "MCO_IDXST_FEATURE_OPTIMIZED", "MCO_IDXST_FUNCTION_REGULAR" [ "plabel": "PerfReading.stamp_idx", "keys_num": 270, "pages_num": 23, "avg_cmp": 3, "max_cmp": 3, "btree": { "levels_num": 2, "duplicates_num": 0 } } ] }, { "table_name": "PerfTimingReading", "objects_num": 270, "versions_num": 270, "core_pages": 1080, "blob_pages": 0, "seq_pages": 0, "core_space": 138240, "indexes": [ { "type": 128, "type_s": [ "MCO_IDXST_TYPE_MEM", "MCO_IDXST_NATURE_BTREE", "MCO_IDXST_FEATURE_OPTIMIZED", "MCO_IDXST_FUNCTION_REGULAR" [ "plabel": "PerfTimingReading.rec_idx", "keys_num": 270, "pages_num": 23, "avg_cmp": 3, "max_cmp": 3, "btree": { "levels_num": 2, "duplicates_num": 0 } }, { "type": 128, "type_s": [ "MCO_IDXST_TYPE_MEM", "MCO_IDXST_NATURE_BTREE", "MCO_IDXST_FEATURE_OPTIMIZED", "MCO_IDXST_FUNCTION_REGULAR" [ "plabel": "PerfTimingReading.stamp_idx", "keys_num": 270, "pages_num": 23, "avg_cmp": 3, "max_cmp": 3, "btree": { "levels_num": 2, "duplicates_num": 0 } } ] } ] }To view the database statistics for a simple persistent database, the following http request
http://localhost:8083/api/db/diskdb/statwhere xSQL is started with the following config file:
database_name : diskdb, database_size : 20m, cache_size : 10m, database_filename: "diskdb.dbs", # database file name, string log_filename : "diskdb.log", # log file name, string runtime_configuration : { debug_library : false, disk_support : true, shared_memory : false, transaction_manager : mursiw }, rest : { port : 8083 }, schema : " #define uint2 unsigned<2> declare database locatedb; class Employee { string name; uint2 dept_no; unique tree<name> Iname; tree<dept_no> Idept; }; ", db_params: { mem_page_size : 512, disk_page_size : 8192 }, sql_trace : false, sql_port : 5500, sql_statements : "INSERT INTO Employee(name, dept_no) VALUES (['Luke Skywalker', 'Han Solo', 'Darth Vader'], [1,1,2]);"would display the following statistics:
{ "mem": { "free_pages": 39513, "total_pages": 39564, "page_size": 512 }, "disk": { "data_file_size": 147456, "log_file_size": 4, "used_database_size": 148992, "cache": { "connection_cache_hits": 0, "cache_hits": 0, "cache_misses": 15, "allocated_pages": 1246, "used_pages": 13, "pinned_pages": 10, "modified_pages": 0, "dirty_pages": 0, "copied_pages": 0, "write_delayed_pages": 0, "subsequent_reads": 12 } }, "classes": [ { "table_name": "Employee", "objects_num": 3, "versions_num": 3, "core_pages": 3, "blob_pages": 0, "core_space": 1536, "indexes": [ { "type": 128, "type_s": [ "MCO_IDXST_TYPE_MEM", "MCO_IDXST_NATURE_BTREE", "MCO_IDXST_FEATURE_UNIQUE", "MCO_IDXST_FEATURE_OPTIMIZED", "MCO_IDXST_FUNCTION_REGULAR" [ "plabel": "Employee.Iname", "keys_num": 3, "pages_num": 1, "avg_cmp": 1, "max_cmp": 1, "btree": { "levels_num": 0, "duplicates_num": 0 } }, { "type": 128, "type_s": [ "MCO_IDXST_TYPE_MEM", "MCO_IDXST_NATURE_BTREE", "MCO_IDXST_FEATURE_OPTIMIZED", "MCO_IDXST_FUNCTION_REGULAR" [ "plabel": "Employee.Idept_", "keys_num": 3, "pages_num": 1, "avg_cmp": 1, "max_cmp": 1, "btree": { "levels_num": 0, "duplicates_num": 0 } } ] } ] }Database Statistics
mem
The
memsection displays the following statistics:
free_pages The amount of memory available in bytes
total_pages The total amount of memory in used by the database page_size The size of each memory page classes
The
classessection displays the following statistics for each class in the database schema:
table_name The name of the database class (table)
objects_num The total number of objects (rows) of this class (table) versions_num The total number of MVCCversions of the objectscore_pages The number of pages used for all data except blobs blob_pages The number of pages used by blobs seq_pages The number of pages used by sequences core_space The total number of bytes, not counting blobs indexes An array of index statistics (see below) indexes array
type The index type flags; this numeric value is a combination of
MCO_IDXST_*constants defined in themco.hheader filetype_s The array of strings representing the typeflags (above)plabel The index label keys_num The number of keys in the index pages_num The number of pages used by the index avg_cmp The average number of comparisons needed to locate an element max_cmp The maximum number of comparisons needed to locate an element btree For
btreeindexes only:
levels_num The tree height duplicates_num The number of duplicates kdtree For
kdtreeindexes only:
levels_num The tree height hash For
hashindexes only:
avg_chain_length The average number of keys in a basket max_chain_length The number maximum number of keys in a basket table_size The size of the hash table chains_num The number of chains ptree For
ptreeindexes only:
levels_num The tree height duplicates_num The number of duplicates rtree For
rtreeindexes only:
levels_num The tree height duplicates_num The number of duplicates meta For
metaindexes only:
disk_pages_num The number of disk pages Persistent Database Statistics
For persistent databases, the following additional sections are displayed:
disk
The
disksection displays the following statistics:
data_file_size The total size of the database storage
log_file_size The total size of the database log file used_database_size Size of the used part of database storage cache The cache section statistics are described below cache
The
cachesection displays the following disk cache statistics: