Answers for "how to view index in sql"

SQL
1

check all indexes on table

SELECT
    tablename,
    indexname,
    indexdef
FROM
    pg_indexes
WHERE
    schemaname = 'yourschema' and tablename='yourtable'
ORDER BY
    tablename,
    indexname;
(POSTRGRESQL)
Posted by: Guest on June-15-2020
0

display index in sql

SHOW INDEX FROM yourtable;
Posted by: Guest on April-20-2021
0

sql view index

-- Oracle  (all_indexes: depending on grants, dba_indexes: for all indexes))
SELECT index_name FROM user_indexes WHERE table_name = 'MY_TABLE';
-- List of indexed columns:
SELECT index_name, column_position, column_name
FROM user_ind_columns 		-- or all_ind_columns / dba_ind_columns
WHERE table_name = 'MY_TABLE'  
ORDER BY index_name, column_order;
Posted by: Guest on May-16-2021
0

display index in sql

SELECT DISTINCT
    TABLE_NAME,
    INDEX_NAME
FROM INFORMATION_SCHEMA.STATISTICS
WHERE TABLE_SCHEMA = 'your_schema';
Posted by: Guest on April-20-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language