Add indexes to DomainHistory sub tables (#1319)

* Add indexes to DomainHistory sub tables

Add indexes to DomainTransactionRecord and DomainDsDataHistory to speed
up query for DomainHistory. Without these indexes, DomainHistory loading
is extremely slow: 2 QPS with current production data.
This commit is contained in:
Weimin Yu 2021-09-14 14:54:21 -04:00 committed by GitHub
parent 88be34808d
commit a8ddb5c053
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 74 additions and 22 deletions

View file

@ -1489,6 +1489,20 @@ CREATE UNIQUE INDEX database_migration_state_schedule_singleton ON public."Datab
CREATE INDEX domain_dns_refresh_request_time_idx ON public."Domain" USING btree (dns_refresh_request_time);
--
-- Name: domain_history_to_ds_data_history_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX domain_history_to_ds_data_history_idx ON public."DomainDsDataHistory" USING btree (domain_repo_id, domain_history_revision_id);
--
-- Name: domain_history_to_transaction_record_idx; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX domain_history_to_transaction_record_idx ON public."DomainTransactionRecord" USING btree (domain_repo_id, history_revision_id);
--
-- Name: idx1iy7njgb7wjmj9piml4l2g0qi; Type: INDEX; Schema: public; Owner: -
--