yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
9.06k stars 1.08k forks source link

[YSQL] Provide different recommendation for unused primary key from other unused index #12982

Open tedyu opened 2 years ago

tedyu commented 2 years ago

Jira Link: DB-2710

Description

db=# CREATE TABLE copy_tab (a int primary key, b text);
CREATE TABLE
db=# select current_database(), relname as table_name, indexrelname as index_name, pg_get_indexdef(indexrelid) as index_command from pg_stat_user_indexes where idx_scan = 0;
 current_database | table_name |  index_name   |                              index_command
------------------+------------+---------------+-------------------------------------------------------------------------
 db               | copy_tab   | copy_tab_pkey | CREATE UNIQUE INDEX copy_tab_pkey ON public.copy_tab USING lsm (a HASH)
(1 row)

For copy_tab_pkey we should provide different recommendation for unused primary key from other unused index.

sushantrmishra commented 2 years ago

closing as this tracked differently.