mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
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:
parent
fd4a94b9e7
commit
b2554dfdee
5 changed files with 74 additions and 22 deletions
|
@ -261,15 +261,11 @@ td.section {
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="property_name">generated on</td>
|
<td class="property_name">generated on</td>
|
||||||
<<<<<<< HEAD
|
<td class="property_value">2021-09-14 16:11:21.688911</td>
|
||||||
<td class="property_value">2021-08-10 20:50:09.993881</td>
|
|
||||||
=======
|
|
||||||
<td class="property_value">2021-08-11 23:54:56.914311</td>
|
|
||||||
>>>>>>> 475839855 (Add the domain DNS refresh request time field to the DB schema)
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="property_name">last flyway file</td>
|
<td class="property_name">last flyway file</td>
|
||||||
<td id="lastFlywayFile" class="property_value">V101__domain_add_dns_refresh_request_time.sql</td>
|
<td id="lastFlywayFile" class="property_value">V102__add_indexes_to_domain_history_sub_tables.sql</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -288,11 +284,7 @@ td.section {
|
||||||
generated on
|
generated on
|
||||||
</text>
|
</text>
|
||||||
<text text-anchor="start" x="4055.5" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">
|
<text text-anchor="start" x="4055.5" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">
|
||||||
<<<<<<< HEAD
|
2021-09-14 16:11:21.688911
|
||||||
2021-08-10 20:50:09.993881
|
|
||||||
=======
|
|
||||||
2021-08-11 23:54:56.914311
|
|
||||||
>>>>>>> 475839855 (Add the domain DNS refresh request time field to the DB schema)
|
|
||||||
</text>
|
</text>
|
||||||
<polygon fill="none" stroke="#888888" points="3968,-4 3968,-44 4233,-44 4233,-4 3968,-4" /> <!-- allocationtoken_a08ccbef -->
|
<polygon fill="none" stroke="#888888" points="3968,-4 3968,-44 4233,-44 4233,-4 3968,-4" /> <!-- allocationtoken_a08ccbef -->
|
||||||
<g id="node1" class="node">
|
<g id="node1" class="node">
|
||||||
|
|
|
@ -261,15 +261,11 @@ td.section {
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="property_name">generated on</td>
|
<td class="property_name">generated on</td>
|
||||||
<<<<<<< HEAD
|
<td class="property_value">2021-09-14 16:11:19.580097</td>
|
||||||
<td class="property_value">2021-08-10 20:50:07.996141</td>
|
|
||||||
=======
|
|
||||||
<td class="property_value">2021-08-11 23:54:54.724849</td>
|
|
||||||
>>>>>>> 475839855 (Add the domain DNS refresh request time field to the DB schema)
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="property_name">last flyway file</td>
|
<td class="property_name">last flyway file</td>
|
||||||
<td id="lastFlywayFile" class="property_value">V101__domain_add_dns_refresh_request_time.sql</td>
|
<td id="lastFlywayFile" class="property_value">V102__add_indexes_to_domain_history_sub_tables.sql</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -288,11 +284,7 @@ td.section {
|
||||||
generated on
|
generated on
|
||||||
</text>
|
</text>
|
||||||
<text text-anchor="start" x="4755.52" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">
|
<text text-anchor="start" x="4755.52" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">
|
||||||
<<<<<<< HEAD
|
2021-09-14 16:11:19.580097
|
||||||
2021-08-10 20:50:07.996141
|
|
||||||
=======
|
|
||||||
2021-08-11 23:54:54.724849
|
|
||||||
>>>>>>> 475839855 (Add the domain DNS refresh request time field to the DB schema)
|
|
||||||
</text>
|
</text>
|
||||||
<polygon fill="none" stroke="#888888" points="4668.02,-4 4668.02,-44 4933.02,-44 4933.02,-4 4668.02,-4" /> <!-- allocationtoken_a08ccbef -->
|
<polygon fill="none" stroke="#888888" points="4668.02,-4 4668.02,-44 4933.02,-44 4933.02,-4 4668.02,-4" /> <!-- allocationtoken_a08ccbef -->
|
||||||
<g id="node1" class="node">
|
<g id="node1" class="node">
|
||||||
|
@ -9732,6 +9724,23 @@ td.section {
|
||||||
<td class="minwidth">ds_data_history_revision_id</td>
|
<td class="minwidth">ds_data_history_revision_id</td>
|
||||||
<td class="minwidth">ascending</td>
|
<td class="minwidth">ascending</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" class="name">domain_history_to_ds_data_history_idx</td>
|
||||||
|
<td class="description right">[non-unique index]</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="spacer"></td>
|
||||||
|
<td class="minwidth">domain_repo_id</td>
|
||||||
|
<td class="minwidth">ascending</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="spacer"></td>
|
||||||
|
<td class="minwidth">domain_history_revision_id</td>
|
||||||
|
<td class="minwidth">ascending</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
@ -10627,6 +10636,23 @@ td.section {
|
||||||
<td class="minwidth">id</td>
|
<td class="minwidth">id</td>
|
||||||
<td class="minwidth">ascending</td>
|
<td class="minwidth">ascending</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" class="name">domain_history_to_transaction_record_idx</td>
|
||||||
|
<td class="description right">[non-unique index]</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="spacer"></td>
|
||||||
|
<td class="minwidth">domain_repo_id</td>
|
||||||
|
<td class="minwidth">ascending</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="spacer"></td>
|
||||||
|
<td class="minwidth">history_revision_id</td>
|
||||||
|
<td class="minwidth">ascending</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
|
|
@ -99,3 +99,4 @@ V98__add_last_expiring_cert_notification_sent_date.sql
|
||||||
V99__drop_kms_secret_table.sql
|
V99__drop_kms_secret_table.sql
|
||||||
V100__database_migration_schedule.sql
|
V100__database_migration_schedule.sql
|
||||||
V101__domain_add_dns_refresh_request_time.sql
|
V101__domain_add_dns_refresh_request_time.sql
|
||||||
|
V102__add_indexes_to_domain_history_sub_tables.sql
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
-- Copyright 2021 The Nomulus Authors. All Rights Reserved.
|
||||||
|
--
|
||||||
|
-- Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
-- you may not use this file except in compliance with the License.
|
||||||
|
-- You may obtain a copy of the License at
|
||||||
|
--
|
||||||
|
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
--
|
||||||
|
-- Unless required by applicable law or agreed to in writing, software
|
||||||
|
-- distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
-- See the License for the specific language governing permissions and
|
||||||
|
-- limitations under the License.
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS domain_history_to_transaction_record_idx
|
||||||
|
ON "DomainTransactionRecord" (domain_repo_id, history_revision_id);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS domain_history_to_ds_data_history_idx
|
||||||
|
ON "DomainDsDataHistory" (domain_repo_id, domain_history_revision_id);
|
|
@ -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);
|
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: -
|
-- Name: idx1iy7njgb7wjmj9piml4l2g0qi; Type: INDEX; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
|
Loading…
Add table
Reference in a new issue