Page MenuHomePhabricator

Add a missing key on DrydockLease
ClosedPublic

Authored by epriestley on Oct 26 2017, 8:20 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 25, 5:53 PM
Unknown Object (File)
Tue, Dec 24, 8:23 AM
Unknown Object (File)
Fri, Dec 13, 4:32 AM
Unknown Object (File)
Mon, Dec 9, 3:57 PM
Unknown Object (File)
Mon, Dec 9, 1:17 PM
Unknown Object (File)
Sat, Nov 30, 12:58 AM
Unknown Object (File)
Nov 27 2024, 12:42 AM
Unknown Object (File)
Nov 25 2024, 6:36 AM
Subscribers
Restricted Owners Package

Details

Summary

Depends on D18734. See PHI176. We run this query on the main Drydock lease web UI, among other places. There is currently no status key which can satisfy it.

Test Plan

Viewed Drydock lease page to get the query.

Ran explain SELECT * FROM `drydock_lease` WHERE (status IN ('pending', 'acquired', 'active')) ORDER BY `id` DESC LIMIT 101; before and after the change.

I don't have a ton of leases locally so the un-key'd EXPLAIN isn't that bad, but still shows that we're getting a better key. Before:

mysql> explain SELECT * FROM `drydock_lease` WHERE (status IN ('pending', 'acquired', 'active')) ORDER BY `id` DESC LIMIT 101;
+----+-------------+---------------+-------+---------------+---------+---------+------+------+-------------+
| id | select_type | table         | type  | possible_keys | key     | key_len | ref  | rows | Extra       |
+----+-------------+---------------+-------+---------------+---------+---------+------+------+-------------+
|  1 | SIMPLE      | drydock_lease | index | NULL          | PRIMARY | 4       | NULL |  101 | Using where |
+----+-------------+---------------+-------+---------------+---------+---------+------+------+-------------+
1 row in set (0.00 sec)

After:

mysql> explain SELECT * FROM `drydock_lease` WHERE (status IN ('pending', 'acquired', 'active')) ORDER BY `id` DESC LIMIT 101;
+----+-------------+---------------+-------+---------------+------------+---------+------+------+---------------------------------------+
| id | select_type | table         | type  | possible_keys | key        | key_len | ref  | rows | Extra                                 |
+----+-------------+---------------+-------+---------------+------------+---------+------+------+---------------------------------------+
|  1 | SIMPLE      | drydock_lease | range | key_status    | key_status | 130     | NULL |    5 | Using index condition; Using filesort |
+----+-------------+---------------+-------+---------------+------------+---------+------+------+---------------------------------------+
1 row in set (0.00 sec)

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Owners added a subscriber: Restricted Owners Package.Oct 26 2017, 8:20 PM
Harbormaster completed remote builds in B18747: Diff 44966.
This revision is now accepted and ready to land.Oct 26 2017, 9:34 PM
This revision was automatically updated to reflect the committed changes.