SHOW CREATE INDEX
Use the SHOW CREATE INDEX
command to see what query was used to create the specified index.
Syntax
SHOW CREATE INDEX index_name;
Parameters
Parameter | Description |
---|---|
index_name | The index to show the query of. |
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 CREATE INDEX
command on idx1
to see the query used.
SHOW CREATE INDEX idx1;
Name | Create Sql
-------------+---------------------------------
public.idx1 | CREATE INDEX idx1 ON t3(v1, v2)
(1 row)