All Products
Search
Document Center

Tablestore:Query the index information about a table

Last Updated:Aug 19, 2024

You can execute the show index statement to query the index information about a table, such the index name, index fields, and index type.

Note

For more information about the show index statement, see Query the index information about a table.

Prerequisites

Usage notes

Tablestore SDK for PHP V5.1.0 or later supports the SQL query feature. Before you use the SQL query feature, make sure that Tablestore SDK for PHP V5.1.0 or later is obtained. For information about the versions of Tablestore SDK for PHP, see Version history of Tablestore SDK for PHP.

Parameters

Parameter

Description

query

The SQL statement. Configure the parameter based on the required feature.

Examples

The following sample code provides an example on how to execute the SHOW INDEX IN `tableName`; statement to query the index information about a table named tableName:

$request = array(
    'query' => 'SHOW INDEX IN `tableName`;',
);
$response = $otsClient->sqlQuery ($request);
$sqlRows = $response['sql_rows'];
print json_encode($sqlRows, JSON_PRETTY_PRINT);

References

  • If you want to use a specific search index to query data when you use the SQL query feature, you can execute the CREATE TABLE statement to create a mapping table for the search index. For more information, see Create mapping tables for search indexes.

  • You can execute SQL statements to query data based on the fields of an index. For more information, see Query data.