Mercurial > kallithea
changeset 4753:30a1b3fdd713
db: add indices where queries takes more than 100 ms
CREATE INDEX cc_pull_request_id_idx ON changeset_comments USING btree (pull_request_id);
CREATE INDEX cs_changeset_comment_id_idx ON changeset_statuses USING btree (changeset_comment_id);
CREATE INDEX cs_pull_request_id_idx ON changeset_statuses USING btree (pull_request_id);
CREATE INDEX pr_org_repo_id_idx ON pull_requests USING btree (org_repo_id);
CREATE INDEX pr_other_repo_id_idx ON pull_requests USING btree (other_repo_id);
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Tue, 06 Jan 2015 00:54:36 +0100 |
parents | ad374c171656 |
children | 3246e58d1543 |
files | kallithea/model/db.py |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/model/db.py Tue Jan 06 00:54:36 2015 +0100 +++ b/kallithea/model/db.py Tue Jan 06 00:54:36 2015 +0100 @@ -2132,6 +2132,7 @@ __tablename__ = 'changeset_comments' __table_args__ = ( Index('cc_revision_idx', 'revision'), + Index('cc_pull_request_id_idx', 'pull_request_id'), {'extend_existing': True, 'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}, ) @@ -2178,6 +2179,8 @@ __table_args__ = ( Index('cs_revision_idx', 'revision'), Index('cs_version_idx', 'version'), + Index('cs_pull_request_id_idx', 'pull_request_id'), + Index('cs_changeset_comment_id_idx', 'changeset_comment_id'), UniqueConstraint('repo_id', 'revision', 'version'), {'extend_existing': True, 'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8', 'sqlite_autoincrement': True} @@ -2227,6 +2230,8 @@ class PullRequest(Base, BaseModel): __tablename__ = 'pull_requests' __table_args__ = ( + Index('pr_org_repo_id_idx', 'org_repo_id'), + Index('pr_other_repo_id_idx', 'other_repo_id'), {'extend_existing': True, 'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8', 'sqlite_autoincrement': True}, )