[Maria-developers] New (by Shinguz): Index usage tracker (103)
----------------------------------------------------------------------- WORKLOG TASK -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- TASK...........: Index usage tracker CREATION DATE..: Wed, 10 Mar 2010, 11:29 SUPERVISOR.....: Bothorsen IMPLEMENTOR....: COPIES TO......: CATEGORY.......: Client-BackLog TASK ID........: 103 (http://askmonty.org/worklog/?tid=103) VERSION........: Benchmarks-3.0 STATUS.........: Un-Assigned PRIORITY.......: 60 WORKED HOURS...: 0 ESTIMATE.......: 0 (hours remain) ORIG. ESTIMATE.: 0 PROGRESS NOTES: DESCRIPTION: What indexes are needed is often easy to find. What is more difficult is to find which indexes are not used at all. Thus some statistics about the index usage would be nice. I think Percona has already something like this done some time ago. And big O has similar functionality. I could imagine something like this: +------------+------------+--------------+---------------------+---------------------+---------------------+------------+----------+-----------+-----------+------------+ | table_name | index_name | index_length | create_time | update_time | use_time | read_first | read_key | read_next | full_scan | range_scan | +------------+------------+--------------+---------------------+---------------------+---------------------+------------+----------+-----------+-----------+------------+ | test_table | idx1 | 1234567890 | 2010-01-01 00:00:00 | 2010-01-01 00:00:00 | 2010-03-10 11:34:56 | 1234 | 42560 | 2468 | 234 | 321 | | test_table | idx2 | 123456 | 2010-01-01 00:00:00 | NULL | NULL | 0 | 0 | 0 | 0 | 0 | | test_table | idx3 | 234561 | 2010-01-01 00:00:00 | 2010-03-10 11:12:34 | 2010-03-10 11:34:56 | 7890 | 89890 | 15780 | 678 | 321 | | test_table | idx4 | 345612 | 2010-01-01 00:00:00 | 2010-03-10 11:34:56 | NULL | 0 | 0 | 0 | 0 | 0 | | test_table | idx5 | 456123 | 2010-01-01 00:00:00 | 2010-03-10 06:56:12 | NULL | 0 | 0 | 0 | 0 | 0 | | test_table | idx6 | 561234 | 2010-01-01 00:00:00 | 2010-03-10 01:12:34 | 2010-03-10 11:34:42 | 3456 | 12356 | 6912 | 123 | 12 | +------------+------------+--------------+---------------------+---------------------+---------------------+------------+----------+-----------+-----------+------------+ Possibly this could/should be implemented on the handler interface level because there we know what we are touching? But I am not familiar with the code. ESTIMATED WORK TIME ESTIMATED COMPLETION DATE ----------------------------------------------------------------------- WorkLog (v3.5.9)
Hi On 10/03/2010, at 9:29 PM, worklog-noreply@askmonty.org wrote:
----------------------------------------------------------------------- WORKLOG TASK -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- =- TASK...........: Index usage tracker CREATION DATE..: Wed, 10 Mar 2010, 11:29 SUPERVISOR.....: Bothorsen
DESCRIPTION:
What indexes are needed is often easy to find. What is more difficult is to find which indexes are not used at all.
Thus some statistics about the index usage would be nice.
I think Percona has already something like this done some time ago. And big O has similar functionality.
For appropriate credit: it comes from the Google patches, released by Mark Callaghan. It's in the Percona and OurDelta 5.0 builds. SHOW INDEX STATISTICS, or more useful the INDEX_STATISTICS table in information_schema. More useful since then it can be LEFT JOINed onto the other infoschema tables that know which indexes exist, thus easily identifying unused ones. For reference on what the table shows, see the patch - easy to find in the lp:ourdelta repo. Let's not just reinvent from scratch please. Regards, Arjen. -- Arjen Lentz, Exec.Director @ Open Query (http://openquery.com) Exceptional Services for MySQL at a fixed budget. Follow our blog at http://openquery.com/blog/ OurDelta: packages for MySQL and MariaDB @ http://ourdelta.org
hi!
"Arjen" == Arjen Lentz <arjen@openquery.com> writes:
Arjen> Hi Arjen> On 10/03/2010, at 9:29 PM, worklog-noreply@askmonty.org wrote:
----------------------------------------------------------------------- WORKLOG TASK -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- =- TASK...........: Index usage tracker CREATION DATE..: Wed, 10 Mar 2010, 11:29 SUPERVISOR.....: Bothorsen
DESCRIPTION:
What indexes are needed is often easy to find. What is more difficult is to find which indexes are not used at all.
Thus some statistics about the index usage would be nice.
I think Percona has already something like this done some time ago. And big O has similar functionality.
Arjen> For appropriate credit: it comes from the Google patches, released by Arjen> Mark Callaghan. Arjen> It's in the Percona and OurDelta 5.0 builds. Arjen> SHOW INDEX STATISTICS, or more useful the INDEX_STATISTICS table in Arjen> information_schema. Arjen> More useful since then it can be LEFT JOINed onto the other infoschema Arjen> tables that know which indexes exist, thus easily identifying unused Arjen> ones. Arjen> For reference on what the table shows, see the patch - easy to find in Arjen> the lp:ourdelta repo. Arjen> Let's not just reinvent from scratch please. The patches are already in MariaDB 5.2 since some time ago. I have updated the worklog accordingly. Regards, Monty
participants (3)
-
Arjen Lentz
-
Michael Widenius
-
worklog-noreply@askmonty.org