`Ctrl`+`K`

# 7.3.41. `object_inspect`

## 7.3.41.1. Summary

New in version 6.0.0.

`object_inspect` inspects an object. You can confirm details of an object.

For example:

> - If the object is a table, you can confirm the number of records in the table.

> - If the object is a column, you can confirm the type of value of the column.

## 7.3.41.2. Syntax

This command takes only one optional parameter:

    object_inspect [name=null]

## 7.3.41.3. Usage

You can inspect an object in the database specified by `name`:

Execution example:

    table_create Users TABLE_HASH_KEY ShortText
    # [[0, 1337566253.89858, 0.000355720520019531], true]
    load --table Users
    [
    {"_key": "Alice"}
    ]
    # [[0, 1337566253.89858, 0.000355720520019531], 1]
    object_inspect Users
    # [
    #   [
    #     0,
    #     1337566253.89858,
    #     0.000355720520019531
    #   ],
    #   {
    #     "disk_usage": 16842752,
    #     "name": "Users",
    #     "n_records": 1,
    #     "value": {
    #       "type": null
    #     },
    #     "key": {
    #       "total_size": 5,
    #       "max_total_size": 4294967295,
    #       "type": {
    #         "size": 4096,
    #         "type": {
    #           "id": 32,
    #           "name": "type"
    #         },
    #         "id": 14,
    #         "name": "ShortText"
    #       }
    #     },
    #     "type": {
    #       "id": 48,
    #       "name": "table:hash_key"
    #     },
    #     "id": 256
    #   }
    # ]

The `object_inspect Users` returns the following information:

> - The name of the table: `"name": Users`

> - The total used key size: `"key": {"total_size": 5}` (`"Alice"` is 5 byte data)

> - The maximum total key size: `"key": {"max_total_size": 4294967295}`

> - and so on.

You can inspect the database by not specifying `name`:

Execution example:

    object_inspect
    # [
    #   [
    #     0,
    #     1337566253.89858,
    #     0.000355720520019531
    #   ],
    #   {
    #     "disk_usage": 22347776,
    #     "name_table": {
    #       "disk_usage": 1052672,
    #       "name": "",
    #       "n_records": 256,
    #       "value": null,
    #       "key": {
    #         "type": null
    #       },
    #       "type": {
    #         "id": 50,
    #         "name": "table:dat_key"
    #       },
    #       "id": 0
    #     },
    #     "type": {
    #       "id": 55,
    #       "name": "db"
    #     }
    #   }
    # ]

The `object_inspect` returns the following information:

> - The table type for object name management: `"key": {"type": {"name": "table:dat_key"}}`

> - and so on.

## 7.3.41.4. Parameters

This section describes all parameters.

### 7.3.41.4.1. Required parameters

There is no required parameter.

### 7.3.41.4.2. Optional parameters

There is only one optional parameter.

#### 7.3.41.4.2.1. `name`

Specifies the object name to be inspected.

If `name` isn’t specified, the database is inspected.

## 7.3.41.5. Return value

The command returns an object (nested key and value pairs) that includes details of the object (such as table) as body:

    [HEADER, object]

See Output format for `HEADER`.

The format of the details is depends on object type. For example, table has key information but function doesn’t have key information.

### 7.3.41.5.1. Database

Database inspection returns the following information:

    {
      "type": {
        "id": DATABASE_TYPE_ID,
        "name": DATABASE_TYPE_NAME
      },
      "name_table": DATABASE_NAME_TABLE
    }

#### 7.3.41.5.1.1. `DATABASE_TYPE_ID`

`DATABASE_TYPE_ID` is always `55`.

#### 7.3.41.5.1.2. `DATABASE_TYPE_NAME`

`DATABASE_TYPE_NAME` is always `"db"`.

#### 7.3.41.5.1.3. `DATABASE_NAME_TABLE`

`DATABASE_NAME_TABLE` is a table for managing object names in the database. The table is TABLE_PAT_KEY or TABLE_DAT_KEY. Normally, it’s TABLE_DAT_KEY.

See Table for format details.

### 7.3.41.5.2. Table

Table inspection returns the following information:

    {
      "id": TABLE_ID,
      "name": TABLE_NAME,
      "type": {
        "id": TABLE_TYPE_ID,
        "name": TABLE_TYPE_NAME
      },
      "key": {
        "type": TABLE_KEY_TYPE,
        "total_size": TABLE_KEY_TOTAL_SIZE
        "max_total_size": TABLE_KEY_MAX_TOTAL_SIZE
      },
      "value": {
        "type": TABLE_VALUE_TYPE,
      },
      "n_records": TABLE_N_RECORDS
    }

There are some exceptions:

> - TABLE_NO_KEY doesn’t return key information because it doesn’t have key.

> - TABLE_DAT_KEY doesn’t return value information because it doesn’t have value.

#### 7.3.41.5.2.1. `TABLE_ID`

The ID of the inspected table.

#### 7.3.41.5.2.2. `TABLE_NAME`

The name of the inspected table.

#### 7.3.41.5.2.3. `TABLE_TYPE_ID`

The type ID of the inspected table.

Here is a list of type IDs:

Table type | ID
--- | ---
TABLE_HASH_KEY | `48`
TABLE_PAT_KEY | `49`
TABLE_DAT_KEY | `50`
TABLE_NO_KEY | `51`

#### 7.3.41.5.2.4. `TABLE_TYPE_NAME`

The type name of the inspected table.

Here is a list of type names:

Table type | Name
--- | ---
TABLE_HASH_KEY | `"table:hash_key"`
TABLE_PAT_KEY | `"table:pat_key"`
TABLE_DAT_KEY | `"table:dat_key"`
TABLE_NO_KEY | `"table:no_key"`

#### 7.3.41.5.2.5. `TABLE_KEY_TYPE`

The type of key of the inspected table.

See Type for format details.

#### 7.3.41.5.2.6. `TABLE_KEY_TOTAL_SIZE`

The total key size of the inspected table in bytes.

#### 7.3.41.5.2.7. `TABLE_KEY_MAX_TOTAL_SIZE`

The maximum total key size of the inspected table in bytes.

#### 7.3.41.5.2.8. `TABLE_VALUE_TYPE`

The type of value of the inspected table.

See Type for format details.

#### 7.3.41.5.2.9. `TABLE_N_RECORDS`

The number of records of the inspected table.

It’s a 64bit unsigned integer value.

### 7.3.41.5.3. Column

New in version 7.0.2.

Data column (scalar column and vector column) returns the following information:

    {
      "id": COLUMN_ID,
      "name": COLUMN_NAME
      "table": COLUMN_TABLE,
      "full_name": COLUMN_FULL_NAME,
      "type": {
        "name": COLUMN_TYPE_NAME,
        "raw": {
          "id": COLUMN_TYPE_RAW_ID,
          "name": COLUMN_TYPE_RAW_NAME
        }
      },
      "value": {
        "type": COLUMN_VALUE_TYPE,
        "compress": DATA_COLUMN_VALUE_COMPRESS_METHOD,
      }
    }

Index column is similar to data column but there are some differences.

> - Index column doesn’t have `value.compress` key.

> - Index column has `value.section` key.

> - Index column has `value.weight` key.

> - Index column has `value.position` key.

> - Index column has `value.size` key.

> - Index column has `value.statistics` key.

> - Index column has `sources` key.

Index column returns the following information:

    {
      "id": COLUMN_ID,
      "name": COLUMN_NAME
      "table": COLUMN_TABLE,
      "full_name": COLUMN_FULL_NAME,
      "type": {
        "name": COLUMN_TYPE_NAME,
        "raw": {
          "id": COLUMN_TYPE_RAW_ID,
          "name": COLUMN_TYPE_RAW_NAME
        }
      },
      "value": {
        "type": COLUMN_VALUE_TYPE,
        "section": INDEX_COLUMN_VALUE_SECTION,
        "weight": INDEX_COLUMN_VALUE_WEIGHT,
        "position": INDEX_COLUMN_VALUE_POSITION,
        "size": INDEX_COLUMN_VALUE_SIZE,
        "statistics": {
          "max_section_id": INDEX_COLUMN_VALUE_STATISTICS_MAX_SECTION_ID,
          "n_garbage_segments": INDEX_COLUMN_VALUE_STATISTICS_N_GARBAGE_SEGMENTS,
          "max_array_segment_id": INDEX_COLUMN_VALUE_STATISTICS_MAX_ARRAY_SEGMENT_ID,
          "n_array_segments": INDEX_COLUMN_VALUE_STATISTICS_N_ARRAY_SEGMENTS,
          "max_buffer_segment_id": INDEX_COLUMN_VALUE_STATISTICS_MAX_BUFFER_SEGMENT_ID,
          "n_buffer_segments": INDEX_COLUMN_VALUE_STATISTICS_N_BUFFER_SEGMENTS,
          "max_in_use_physical_segment_id": INDEX_COLUMN_VALUE_STATISTICS_MAX_IN_USE_PHYSICAL_SEGMENT_ID,
          "n_unmanaged_segments": INDEX_COLUMN_VALUE_STATISTICS_N_UNMANAGED_SEGMENTS,
          "total_chunk_size": INDEX_COLUMN_VALUE_STATISTICS_TOTAL_CHUNK_SIZE,
          "max_in_use_chunk_id": INDEX_COLUMN_VALUE_STATISTICS_MAX_IN_USE_CHUNK_ID,
          "n_garbage_chunks": INDEX_COLUMN_VALUE_STATISTICS_N_GARBAGE_CHUNKS
          "next_physical_segment_id": INDEX_COLUMN_VALUE_STATISTICS_NEXT_PHYSICAL_SEGMENT_ID
          "max_n_physical_segments": INDEX_COLUMN_VALUE_STATISTICS_N_PHYSICAL_SEGMENTS
        }
      },
      "sources": [
        {
          "id": INDEX_COLUMN_SOURCE_ID,
          "name": INDEX_COLUMN_SOURCE_NAME,
          "table": INDEX_COLUMN_SOURCE_TABLE,
          "full_name": INDEX_COLUMN_SOURCE_FULL_NAME
        },
        ...
      ]
    }

#### 7.3.41.5.3.1. `COLUMN_ID`

The ID of the inspected column.

#### 7.3.41.5.3.2. `COLUMN_NAME`

The name of the inspected column.

It doesn’t include table name. It’s just only column name.

If you want full column name (`TABLE_NAME.COLUMN_NAME` style), use COLUMN_FULL_NAME instead.

#### 7.3.41.5.3.3. `COLUMN_TABLE`

The table of the inspected column.

See Table for format details.

#### 7.3.41.5.3.4. `COLUMN_FULL_NAME`

The full name of the inspected column.

It includes both table name and column name as `TABLE_NAME.COLUMN_NAME` format.

If you just want only column name, use COLUMN_NAME instead.

#### 7.3.41.5.3.5. `COLUMN_TYPE_NAME`

The type name of the inspected column.

Here is a list of type names:

Column type | Name
--- | ---
Scalar column | `"scalar"`
Vector column | `"vector"`
Index column | `"index"`

#### 7.3.41.5.3.6. `COLUMN_TYPE_RAW_ID`

The raw type ID of the inspected column.

Here is a list of raw type IDs:

Raw column type | ID
--- | ---
Fix size column | `64`
Variable size column | `65`
Index column | `72`

#### 7.3.41.5.3.7. `COLUMN_TYPE_RAW_NAME`

The raw type name of the inspected column.

Here is a list of raw type names:

Raw column type | Name
--- | ---
Fix size column | `"column:fix_size"`
Variable size column | `"column:var_size"`
Index column | `"column:index"`

#### 7.3.41.5.3.8. `COLUMN_VALUE_TYPE`

The type of value of the inspected column.

See Type for format details.

#### 7.3.41.5.3.9. `DATA_COLUMN_VALUE_COMPRESS_METHOD`

The compress method of value of the inspected data column.

Here is a list of compress methods:

Compress method | Value
--- | ---
zlib | `"zlib"`
LZ4 | `"lz4"`
Zstandard | `"zstd"`
None | `null`

#### 7.3.41.5.3.10. `INDEX_COLUMN_VALUE_SECTION`

Whether the inspected column is created with `WITH_SECTION` flag or not. The value is `true` if `WITH_SECTION` was specified, `false` otherwise.

See also

flags

#### 7.3.41.5.3.11. `INDEX_COLUMN_VALUE_WEIGHT`

Whether the inspected column is created with `WITH_WEIGHT` flag or not. The value is `true` if `WITH_WEIGHT` was specified, `false` otherwise.

See also

flags

#### 7.3.41.5.3.12. `INDEX_COLUMN_VALUE_POSITION`

Whether the inspected column is created with `WITH_POSITION` flag or not. The value is `true` if `WITH_POSITION` was specified, `false` otherwise.

See also

flags

#### 7.3.41.5.3.13. `INDEX_COLUMN_VALUE_SIZE`

The size of the inspected index column. Index size can be specified by flags.

Here is a list of index column sizes:

Index column size | Value
--- | ---
`INDEX_SMALL` | `"small"`
`INDEX_MEDIUM` | `"medium"`
`INDEX_LARGE` | `"large"`
Default | `"normal"`

#### 7.3.41.5.3.14. `INDEX_COLUMN_VALUE_STATISTICS_MAX_SECTION_ID`

The max section ID in the inspected index column.

It’s always `0` for index column that is created without `WITH_SECTION` flag.

It’s `0` or larger for index column that is created with `WITH_SECTION` flag. It’s `0` for empty `WITH_SECTION` index column. It’s `1` or larger for non-empty `WITH_SECTION` index column.

The max value for `WITH_SECTION` index column is the number of source columns.

#### 7.3.41.5.3.15. `INDEX_COLUMN_VALUE_STATISTICS_N_GARBAGE_SEGMENTS`

The number of garbage segments in the inspected index column.

Index column reuses segment (internal allocated space) that is no longer used. It’s called “garbage segment”.

The max value is the max number of segments. See INDEX_COLUMN_VALUE_STATISTICS_N_PHYSICAL_SEGMENTS for the max number of segments.

#### 7.3.41.5.3.16. `INDEX_COLUMN_VALUE_STATISTICS_MAX_ARRAY_SEGMENT_ID`

The max ID of segment used for “array” in the inspected index column.

“array” is used for managing “buffer”.

The max value is the max number of segments. See INDEX_COLUMN_VALUE_STATISTICS_N_PHYSICAL_SEGMENTS for the max number of segments.

#### 7.3.41.5.3.17. `INDEX_COLUMN_VALUE_STATISTICS_N_ARRAY_SEGMENTS`

The number of segments used for “array” in the inspected index column.

“array” is used for managing “buffer”.

The max value is `the max number of segments - the number of segments used for "buffer"`. See INDEX_COLUMN_VALUE_STATISTICS_N_PHYSICAL_SEGMENTS for the max number of segments.

#### 7.3.41.5.3.18. `INDEX_COLUMN_VALUE_STATISTICS_MAX_BUFFER_SEGMENT_ID`

The max ID of segment used for “buffer” in the inspected index column.

“buffer” is used for storing posting lists.

The max value is the max number of segments. See INDEX_COLUMN_VALUE_STATISTICS_N_PHYSICAL_SEGMENTS for the max number of segments.

#### 7.3.41.5.3.19. `INDEX_COLUMN_VALUE_STATISTICS_N_BUFFER_SEGMENTS`

The number of segments used for “buffer” in the inspected index column.

“buffer” is used for storing posting lists.

The max value is `the max number of segments - the number of segments used for "array"`. See INDEX_COLUMN_VALUE_STATISTICS_N_PHYSICAL_SEGMENTS for the max number of segments.

#### 7.3.41.5.3.20. `INDEX_COLUMN_VALUE_STATISTICS_MAX_IN_USE_PHYSICAL_SEGMENT_ID`

The max segment ID in use as “garbage”, “array” or “buffer” in the inspected index column.

The max value is the max number of segments. See INDEX_COLUMN_VALUE_STATISTICS_N_PHYSICAL_SEGMENTS for the max number of segments.

#### 7.3.41.5.3.21. `INDEX_COLUMN_VALUE_STATISTICS_N_UNMANAGED_SEGMENTS`

The number of unmanaged segments in the inspected index column.

It must be `0`.

#### 7.3.41.5.3.22. `INDEX_COLUMN_VALUE_STATISTICS_TOTAL_CHUNK_SIZE`

The total “chunk” size in the inspected index column.

“chunk” is used for storing posting lists. “buffer” is mutable but “chunk” is immutable. “chunk” is more space effective than “buffer”. “buffer” is more update effective than “chunk”.

Small posting lists are stored into “buffer”. Posting lists in “buffer” are moved to “chunk” when these posting lists are grew.

The max value is `the max size of a chunk * the max number of chunks`. But you will not be able to use all spaces because there are overheads.

The max size of a chunk is `2 ** 22` bytes (4MiB). The max number of chunks depend on index size:

Index column size | The max number of chunks
--- | ---
`INDEX_SMALL` | `2**10` (1024)
`INDEX_MEDIUM` | `2**14` (16384)
Default | `2**18` (262144)

#### 7.3.41.5.3.23. `INDEX_COLUMN_VALUE_STATISTICS_MAX_IN_USE_CHUNK_ID`

The max “chunk” ID in use in the inspected index column.

The max value is the max number of chunks. See INDEX_COLUMN_VALUE_STATISTICS_TOTAL_CHUNK_SIZE for the max number of chunks.

#### 7.3.41.5.3.24. `INDEX_COLUMN_VALUE_STATISTICS_N_GARBAGE_CHUNKS`

The array of the number of garbage “chunks” in the inspected index column.

Garbage “chunks” are managed by separated 14 spaces. It shows all the number of garbage “chunks” as an array like the following:

    [
      N_GARBAGE_CHUNKS_IN_SPACE0,
      N_GARBAGE_CHUNKS_IN_SPACE1,
      ...
      N_GARBAGE_CHUNKS_IN_SPACE13
    ]

The max value of each space is the max number of chunks. See INDEX_COLUMN_VALUE_STATISTICS_TOTAL_CHUNK_SIZE for the max number of chunks.

#### 7.3.41.5.3.25. `INDEX_COLUMN_VALUE_STATISTICS_NEXT_PHYSICAL_SEGMENT_ID`

New in version 9.0.2.

This value is the ID of the segment. The inspected index column use it as the next segment ID. The max value is the max number of segments. See INDEX_COLUMN_VALUE_STATISTICS_N_PHYSICAL_SEGMENTS for the max number of segments.

#### 7.3.41.5.3.26. `INDEX_COLUMN_VALUE_STATISTICS_N_PHYSICAL_SEGMENTS`

New in version 9.0.2.

This value the max number of segments. It depends on index size:

Index column size | The max number of segments
--- | ---
`INDEX_SMALL` | `2**9` (512)
`INDEX_MEDIUM` | `2**16` (65536)
`INDEX_LARGE` | `2**17 * 2` (262144)
Default | `2**17` (131072)

If the number of segments tend to exceeds near the future, you need to consider to adopt `INDEX_XXX` flags.

#### 7.3.41.5.3.27. `INDEX_COLUMN_SOURCE_ID`

The ID of a source column of the inspected index column.

#### 7.3.41.5.3.28. `INDEX_COLUMN_SOURCE_NAME`

The name of a source column of the inspected index column.

It doesn’t include table name. It’s just only column name.

If you want full column name (`TABLE_NAME.COLUMN_NAME` style), use INDEX_COLUMN_SOURCE_FULL_NAME instead.

#### 7.3.41.5.3.29. `INDEX_COLUMN_SOURCE_TABLE`

The table of a source column of the inspected index column.

See Table for format details.

#### 7.3.41.5.3.30. `INDEX_COLUMN_SOURCE_FULL_NAME`

The full name of a source column of the inspected index column.

It includes both table name and column name as `TABLE_NAME.COLUMN_NAME` format.

If you just want only column name, use INDEX_COLUMN_SOURCE_NAME instead.

#### 7.3.41.5.3.31. Type

Type inspection returns the following information:

    {
      "id": TYPE_ID,
      "name": TYPE_NAME,
      "type": {
        "id": TYPE_ID_OF_TYPE,
        "name": TYPE_NAME_OF_TYPE
      },
      "size": TYPE_SIZE
    }

#### 7.3.41.5.3.32. `TYPE_ID`

The ID of the inspected type.

Here is an ID list of builtin types:

Type | ID
--- | ---
Bool | `3`
Int8 | `4`
UInt8 | `5`
Int16 | `6`
UInt16 | `7`
Int32 | `8`
UInt32 | `9`
Int64 | `10`
UInt64 | `11`
Float32 | `12`
Time | `13`
ShortText | `14`
Text | `15`
LongText | `16`
TokyoGeoPoint | `17`
WGS84GeoPoint | `18`

#### 7.3.41.5.3.33. `TYPE_NAME`

The name of the inspected type.

Here is a name list of builtin types:

> - Bool

> - Int8

> - UInt8

> - Int16

> - UInt16

> - Int32

> - UInt32

> - Int64

> - UInt64

> - Float32

> - Time

> - ShortText

> - Text

> - LongText

> - TokyoGeoPoint

> - WGS84GeoPoint

#### 7.3.41.5.3.34. `TYPE_ID_OF_TYPE`

`TYPE_ID_OF_TYPE` is always `32`.

#### 7.3.41.5.3.35. `TYPE_NAME_OF_TYPE`

`TYPE_NAME_OF_TYPE` is always `type`.

#### 7.3.41.5.3.36. `TYPE_SIZE`

`TYPE_SIZE` is the size of the inspected type in bytes. If the inspected type is variable size type, the size means the maximum size.