SHOW INDEXES
Use the SHOW INDEXES
command to view indexes from a particular table.
Syntax
SHOW INDEXES FROM table_name [ LIKE_expression ];
Parameters
Parameter | Description |
---|---|
table_name | The table from which indexes will be displayed. |
LIKE_expression | Filters the output based on names by applying pattern matching. See details in LIKE pattern matching expressions. |
Example
We can create a table t3
and an index idx1
on t3
.
CREATE TABLE IF NOT EXISTS t3 (
v1 int,
v2 int,
v3 int);
CREATE INDEX idx1 ON t3 (v1,v2);
Next, we can use the SHOW INDEXES
command on t3
to see existing indexes.
SHOW INDEXES FROM t3;
Name | On | Key | Include | Distributed By
------+----+----------------+---------+----------------
idx1 | t3 | v1 ASC, v2 ASC | v3 | v1, v2
(1 row)