-
-
Save garethrees/42ca8dd64182515d6aa90000463ebfe1 to your computer and use it in GitHub Desktop.
SELECT indexname FROM pg_indexes; |
๐
This is the #1 Google result for "list all indexes postgres" ๐ฑ
@dmcmulle but still has a typo ๐
Btw, if anyone wants to specify a schema: select indexname from pg_indexes where schemaname = 'public';
FIXED:
SELECT indexname FROM pg_indexes;
FIXED:
๐ for taking the time to do this
You can also type \di
You can also type
\di
๐ ๐ ๐ It also shows you additional info that way. On the other hand, if you use select * from pg_indexes;
you also get to see the index definitions.
@runekaagaard is it possible to make the parser handle both versions?
-- select indexes of tables in schema "public" --
select * from pg_indexes where schemaname = 'public';
The table has columns schemaname
, tablename
, indexname
, tablespace
, and SQL query of creation in indexdef
.
Excluding pg_catalog
may be a more useful approach if you are looking for some particular indices:
SELECT indexname FROM pg_indexes WHERE schemaname!='pg_catalog'
Wow, didn't realise this was getting so much attention. I don't think I'd been getting emails about gists until this week โ perhaps its a new GitHub thing. Anyway, fixed :)
I think you mean "select" instead of "selext".