)]}'
{"gerrit-server/src/main/java/com/google/gerrit/server/schema/JdbcAccountPatchReviewStore.java":[{"author":{"_account_id":2,"name":"Monty Taylor","email":"mordred@inaugust.com","username":"mordred"},"change_message_id":"228a828f577a767b8ac56168a208ee7a7de18688","unresolved":false,"context_lines":[{"line_number":161,"context_line":"            + \"file_id INTEGER NOT NULL AUTO_INCREMENT, \""},{"line_number":162,"context_line":"            + \"file_name VARCHAR(4096) DEFAULT \u0027\u0027 NOT NULL, \""},{"line_number":163,"context_line":"            + \"CONSTRAINT primary_key_account_patch_reviews \""},{"line_number":164,"context_line":"            + \"PRIMARY KEY (file_id, account_id, change_id, patch_set_id) \");"},{"line_number":165,"context_line":"    stmt.executeUpdate(\"CREATE INDEX change_patchset_idx \""},{"line_number":166,"context_line":"                       + \"ON account_patch_reviews (change_id, patch_set_id) \");"},{"line_number":167,"context_line":"    stmt.executeUpdate(\"CREATE INDEX file_id_idx \""}],"source_content_type":"text/x-java","patch_set":4,"id":"bf659307_c236ec51","line":164,"updated":"2018-04-02 22:20:06.000000000","message":"In InnoDB, the table is stored clustered on the primary key.\n\nIt would be more efficient to make file_id the primary key and then to make a secondary unique index on account_id, change_id, patch_set_id, file_id.\n\nSo:\n\n  PRIMARY KEY file_id;\n  CREATE UNIQUE INDEX account_change_patch_idx\n    ON account_patch_reviews (\n        account_id, change_id, patch_set_id, file_id);\n\nIf I were gonna nitpick further, I\u0027d want to see if we always are doing lookups with account_id. I\u0027m guessing we don\u0027t - and that change_id, patch_set_id, account_id would be better (account_id basically being in the index to make it covering, rather than to increase cardinality) I don\u0027t have any idea if that is true though.","commit_id":"fcbd45eb46e2d37ef81dd284a812d2e1dcba52b7"}]}
