New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tenant: add missing index #1073

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@pierre
Member

pierre commented Dec 5, 2018

No description provided.

tenant: add missing index
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>

@pierre pierre requested a review from sbrossie Dec 5, 2018

@pierre

This comment has been minimized.

Member

pierre commented Dec 10, 2018

👋@sbrossie 🙂

@@ -33,6 +33,7 @@ CREATE TABLE tenant_kvs (
PRIMARY KEY(record_id)
) /*! CHARACTER SET utf8 COLLATE utf8_bin */;
CREATE INDEX tenant_kvs_key ON tenant_kvs(tenant_key);
CREATE INDEX tenant_kvs_trid_key ON tenant_kvs(tenant_record_id, tenant_key);

This comment has been minimized.

@sbrossie

sbrossie Dec 11, 2018

Member

Do we still need the tenant_kvs_key index? Are we not always interested in searching for the tenant_key for a given tenant?

This comment has been minimized.

@pierre

pierre Dec 12, 2018

Member

tl;dr: I think we can remove it indeed, I will update the PR.

With the index, results of the Ruby integration tests:

Finished in 1146.325216 seconds.

186 tests, 10161 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

Indices usage for the table as reported by MySQL (server restarted before the test run):

mysql> select object_type, object_schema, object_name, index_name, count_star, count_read, count_write, count_fetch, count_insert, count_update, count_delete from performance_schema.table_io_waits_summary_by_index_usage where object_schema = 'killbill' and object_name = 'tenant_kvs';
+-------------+---------------+-------------+---------------------+------------+------------+-------------+-------------+--------------+--------------+--------------+
| object_type | object_schema | object_name | index_name          | count_star | count_read | count_write | count_fetch | count_insert | count_update | count_delete |
+-------------+---------------+-------------+---------------------+------------+------------+-------------+-------------+--------------+--------------+--------------+
| TABLE       | killbill      | tenant_kvs  | PRIMARY             |        210 |        210 |           0 |         210 |            0 |            0 |            0 |
| TABLE       | killbill      | tenant_kvs  | record_id           |          0 |          0 |           0 |           0 |            0 |            0 |            0 |
| TABLE       | killbill      | tenant_kvs  | tenant_kvs_trid_key |       2250 |       2244 |           6 |        2244 |            0 |            6 |            0 |
| TABLE       | killbill      | tenant_kvs  | tenant_kvs_key      |          0 |          0 |           0 |           0 |            0 |            0 |            0 |
| TABLE       | killbill      | tenant_kvs  | NULL                |        209 |          0 |         209 |           0 |          209 |            0 |            0 |
+-------------+---------------+-------------+---------------------+------------+------------+-------------+-------------+--------------+--------------+--------------+
5 rows in set (0.04 sec)

Without the index:

Finished in 1151.187477 seconds.

186 tests, 10161 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

Indices usage (server restarted before the test run):

mysql> select object_type, object_schema, object_name, index_name, count_star, count_read, count_write, count_fetch, count_insert, count_update, count_delete from performance_schema.table_io_waits_summary_by_index_usage where object_schema = 'killbill' and object_name = 'tenant_kvs';
+-------------+---------------+-------------+---------------------+------------+------------+-------------+-------------+--------------+--------------+--------------+
| object_type | object_schema | object_name | index_name          | count_star | count_read | count_write | count_fetch | count_insert | count_update | count_delete |
+-------------+---------------+-------------+---------------------+------------+------------+-------------+-------------+--------------+--------------+--------------+
| TABLE       | killbill      | tenant_kvs  | PRIMARY             |        210 |        210 |           0 |         210 |            0 |            0 |            0 |
| TABLE       | killbill      | tenant_kvs  | record_id           |          0 |          0 |           0 |           0 |            0 |            0 |            0 |
| TABLE       | killbill      | tenant_kvs  | tenant_kvs_trid_key |       2255 |       2249 |           6 |        2249 |            0 |            6 |            0 |
| TABLE       | killbill      | tenant_kvs  | NULL                |        209 |          0 |         209 |           0 |          209 |            0 |            0 |
+-------------+---------------+-------------+---------------------+------------+------------+-------------+-------------+--------------+--------------+--------------+
4 rows in set (0.03 sec)
tenant: remove unused tenant_kvs_key index
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment