Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit 3358a27

Browse files
committed
Ignore indexes named PRIMARY within the schema_unused_indexes view, Primary Keys Are Good
1 parent 5f47671 commit 3358a27

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,8 @@ Finds indexes that have had no events against them (and hence, no usage).
589589

590590
To trust whether the data from this view is representative of your workload, you should ensure that the server has been up for a representative amount of time before using it.
591591

592+
PRIMARY (key) indexes are ignored.
593+
592594
##### Example
593595

594596
```SQL

views/p_s/schema_unused_indexes.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
* you should ensure that the server has been up for a representative amount of
2323
* time before using it.
2424
*
25+
* PRIMARY (key) indexes are ignored.
26+
*
2527
* mysql> select * from schema_unused_indexes limit 5;
2628
* +-------------------------+----------------------------------------+------------+
2729
* | object_schema | object_name | index_name |
@@ -51,4 +53,5 @@ SELECT object_schema,
5153
WHERE index_name IS NOT NULL
5254
AND count_star = 0
5355
AND object_schema != 'mysql'
56+
AND index_name != 'PRIMARY'
5457
ORDER BY object_schema, object_name;

0 commit comments

Comments
 (0)