From 9b7bb12cd1a833b34d7c3a1a053974a5bdebbcf7 Mon Sep 17 00:00:00 2001 From: Ben McIlwain Date: Mon, 7 Mar 2022 16:07:11 -0500 Subject: [PATCH] Add deletionTime/inetAddresses indexes to Host table to support WHOIS (#1548) * Add deletionTime/inetAddresses indexes to Host table to support WHOIS Weimin identified these as missing, and being the cause of slowdowns in NameserverLookupByIpCommand that we're seeing in sandbox. This is the first of two PRs, adding just the Flyway/schema changes. The second PR adding the Java object model changes is #1547. --- .../sql/er_diagram/brief_er_diagram.html | 1246 +++++++++-------- .../sql/er_diagram/full_er_diagram.html | 30 +- db/src/main/resources/sql/flyway.txt | 1 + .../V108__add_host_indexes_for_whois.sql | 17 + .../resources/sql/schema/nomulus.golden.sql | 14 + 5 files changed, 695 insertions(+), 613 deletions(-) create mode 100644 db/src/main/resources/sql/flyway/V108__add_host_indexes_for_whois.sql diff --git a/db/src/main/resources/sql/er_diagram/brief_er_diagram.html b/db/src/main/resources/sql/er_diagram/brief_er_diagram.html index 02a1121ee..fdee13b9a 100644 --- a/db/src/main/resources/sql/er_diagram/brief_er_diagram.html +++ b/db/src/main/resources/sql/er_diagram/brief_er_diagram.html @@ -261,11 +261,11 @@ td.section { generated on - 2022-03-07 15:27:22.193205 + 2022-03-07 19:59:41.272148 last flyway file - V107__add_billingevent_domainrepoid_indexes.sql + V108__add_host_indexes_for_whois.sql @@ -284,7 +284,7 @@ td.section { generated on - 2022-03-07 15:27:22.193205 + 2022-03-07 19:59:41.272148 @@ -615,134 +615,134 @@ td.section { registrar_6e1503e3 - - + + public.Registrar - - + + [table] - + registrar_id - + - + text not null - + iana_identifier - + - + int8 - + registrar_name - + - + text not null - + billingevent_a57d1815:w->registrar_6e1503e3:e - + - - - - + + + + fk_billing_event_registrar_id billingcancellation_6eedf614 - - + + public.BillingCancellation - - + + [table] - + billing_cancellation_id - + - + int8 not null - + registrar_id - + - + text not null - + domain_history_revision_id - + - + int8 not null - + domain_repo_id - + - + text not null - + event_time - + - + timestamptz not null - + billing_time - + - + timestamptz - + billing_event_id - + - + int8 - + billing_recurrence_id - + - + int8 - + billingcancellation_6eedf614:w->billingevent_a57d1815:e - - - + + + @@ -753,9 +753,9 @@ td.section { billingcancellation_6eedf614:w->billingrecurrence_5fa2cb01:e - - - + + + @@ -766,221 +766,221 @@ td.section { billingcancellation_6eedf614:w->domainhistory_a54cc226:e - - - + + + - + - + fk_billing_cancellation_domain_history billingcancellation_6eedf614:w->domainhistory_a54cc226:e - - - + + + - + fk_billing_cancellation_domain_history billingcancellation_6eedf614:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_billing_cancellation_registrar_id domain_6c51cffa - - + + public.Domain - - + + [table] - + repo_id - + - + text not null - + creation_registrar_id - + - + text not null - + creation_time - + - + timestamptz not null - + current_sponsor_registrar_id - + - + text not null - + deletion_time - + - + timestamptz - + last_epp_update_registrar_id - + - + text - + domain_name - + - + text - + tld - + - + text - + admin_contact - + - + text - + billing_contact - + - + text - + registrant_contact - + - + text - + tech_contact - + - + text - + transfer_billing_cancellation_id - + - + int8 - + transfer_billing_event_id - + - + int8 - + transfer_billing_recurrence_id - + - + int8 - + transfer_gaining_registrar_id - + - + text - + transfer_losing_registrar_id - + - + text - + billing_recurrence_id - + - + int8 - + autorenew_end_time - + - + timestamptz - + dns_refresh_request_time - + - + timestamptz - + domain_6c51cffa:w->billingevent_a57d1815:e - - - - + + + + @@ -990,22 +990,22 @@ td.section { domain_6c51cffa:w->billingcancellation_6eedf614:e - - - - - - - - + + + + + + + + fk_domain_transfer_billing_cancellation_id domain_6c51cffa:w->billingrecurrence_5fa2cb01:e - - - + + + @@ -1016,9 +1016,9 @@ td.section { domain_6c51cffa:w->billingrecurrence_5fa2cb01:e - - - + + + @@ -1029,346 +1029,346 @@ td.section { contact_8de8cb16 - - + + public.Contact - - + + [table] - + repo_id - + - + text not null - + creation_registrar_id - + - + text not null - + creation_time - + - + timestamptz not null - + current_sponsor_registrar_id - + - + text not null - + deletion_time - + - + timestamptz - + last_epp_update_registrar_id - + - + text - + contact_id - + - + text - + search_name - + - + text - + transfer_gaining_registrar_id - + - + text - + transfer_losing_registrar_id - + - + text - + domain_6c51cffa:w->contact_8de8cb16:e - - - - - - - - + + + + + + + + fk_domain_admin_contact domain_6c51cffa:w->contact_8de8cb16:e - - - - - - - - + + + + + + + + fk_domain_billing_contact domain_6c51cffa:w->contact_8de8cb16:e - - - - - - - - + + + + + + + + fk_domain_registrant_contact domain_6c51cffa:w->contact_8de8cb16:e - - - - - - - - + + + + + + + + fk_domain_tech_contact domain_6c51cffa:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk2jc69qyg2tv9hhnmif6oa1cx1 domain_6c51cffa:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk2u3srsfbei272093m3b3xwj23 domain_6c51cffa:w->registrar_6e1503e3:e - - - - - - - + + + + + + + fkjc0r9r5y1lfbt4gpbqw4wsuvq domain_6c51cffa:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_domain_transfer_gaining_registrar_id domain_6c51cffa:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_domain_transfer_losing_registrar_id tld_f1fa57e2 - - + + public.Tld - - + + [table] - + tld_name - + - + text not null - + domain_6c51cffa:w->tld_f1fa57e2:e - - - - - - - - + + + + + + + + fk_domain_tld graceperiod_cd3b2e8f - - + + public.GracePeriod - - + + [table] - + grace_period_id - + - + int8 not null - + billing_event_id - + - + int8 - + billing_recurrence_id - + - + int8 - + registrar_id - + - + text not null - + domain_repo_id - + - + text not null - + graceperiod_cd3b2e8f:w->billingevent_a57d1815:e - - - - - - - - + + + + + + + + fk_grace_period_billing_event_id graceperiod_cd3b2e8f:w->domain_6c51cffa:e - - - - - - - - + + + + + + + + fk_grace_period_domain_repo_id graceperiod_cd3b2e8f:w->billingrecurrence_5fa2cb01:e - - - - - - - - + + + + + + + + fk_grace_period_billing_recurrence_id graceperiod_cd3b2e8f:w->registrar_6e1503e3:e - - - - - - - + + + + + + + fk_grace_period_registrar_id @@ -1401,13 +1401,13 @@ td.section { billingrecurrence_5fa2cb01:w->registrar_6e1503e3:e - - - - - - - + + + + + + + fk_billing_recurrence_registrar_id @@ -1480,152 +1480,152 @@ td.section { contact_8de8cb16:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk1sfyj7o7954prbn1exk7lpnoe contact_8de8cb16:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk93c185fx7chn68uv7nl6uv2s0 contact_8de8cb16:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fkmb7tdiv85863134w1wogtxrb2 contact_8de8cb16:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_contact_transfer_gaining_registrar_id contact_8de8cb16:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_contact_transfer_losing_registrar_id contacthistory_d2964f8a - - + + public.ContactHistory - - + + [table] - + history_revision_id - + - + int8 not null - + history_registrar_id - + - + text - + history_modification_time - + - + timestamptz not null - + history_type - + - + text not null - + creation_time - + - + timestamptz - + contact_repo_id - + - + text not null - + contacthistory_d2964f8a:w->contact_8de8cb16:e - - - - - - - - + + + + + + + + fk_contact_history_contact_repo_id contacthistory_d2964f8a:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_contact_history_registrar_id @@ -1731,53 +1731,53 @@ td.section { pollmessage_614a523e:w->domain_6c51cffa:e - + - - - - + + + + fk_poll_message_domain_repo_id pollmessage_614a523e:w->contact_8de8cb16:e - + - - - - - - + + + + + + fk_poll_message_contact_repo_id pollmessage_614a523e:w->contacthistory_d2964f8a:e - + - - - - - + + + + + fk_poll_message_contact_history pollmessage_614a523e:w->contacthistory_d2964f8a:e - + - - - - - + + + + + fk_poll_message_contact_history @@ -1809,74 +1809,90 @@ td.section { host_f21b78de - - + + public.Host - - + + [table] - + repo_id - + - + text not null - + creation_registrar_id - + - + text - + current_sponsor_registrar_id - + - + text - + + deletion_time + + + + + timestamptz + + last_epp_update_registrar_id - + - + text - + host_name - + - + text - + superordinate_domain - + - + text - + + inet_addresses + + + + + _text + + pollmessage_614a523e:w->host_f21b78de:e - + - - - - - + + + + + fk_poll_message_host_repo_id @@ -1976,39 +1992,39 @@ td.section { pollmessage_614a523e:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_poll_message_registrar_id pollmessage_614a523e:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_poll_message_transfer_response_gaining_registrar_id pollmessage_614a523e:w->registrar_6e1503e3:e - + - - - - + + + + fk_poll_message_transfer_response_losing_registrar_id @@ -2063,92 +2079,92 @@ td.section { delegationsignerdata_e542a872 - - + + public.DelegationSignerData - - + + [table] - + domain_repo_id - + - + text not null - + key_tag - + - + int4 not null - + algorithm - + - + int4 not null - + digest - + - + bytea not null - + digest_type - + - + int4 not null - + delegationsignerdata_e542a872:w->domain_6c51cffa:e - - - - - - - - + + + + + + + + fktr24j9v14ph2mfuw2gsmt12kq domainhistory_a54cc226:w->domain_6c51cffa:e - - - - - - - - + + + + + + + + fk_domain_history_domain_repo_id domainhistory_a54cc226:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_domain_history_registrar_id @@ -2182,79 +2198,79 @@ td.section { domainhost_1ea127c2:w->domain_6c51cffa:e - + - - - - - - + + + + + + fkfmi7bdink53swivs390m2btxg domainhost_1ea127c2:w->host_f21b78de:e - - - - - - - - + + + + + + + + fk_domainhost_host_valid host_f21b78de:w->domain_6c51cffa:e - - - - - - - - + + + + + + + + fk_host_superordinate_domain host_f21b78de:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_host_creation_registrar_id host_f21b78de:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_host_current_sponsor_registrar_id host_f21b78de:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_host_last_epp_update_registrar_id @@ -2459,14 +2475,14 @@ td.section { domaintransactionrecord_6e77ff61:w->tld_f1fa57e2:e - - - - - - - - + + + + + + + + fk_domain_transaction_record_tld @@ -2534,27 +2550,27 @@ td.section { hosthistory_56210c2:w->host_f21b78de:e - - - - - - - - + + + + + + + + fk_hosthistory_host hosthistory_56210c2:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_history_registrar_id @@ -2734,13 +2750,13 @@ td.section { registrarpoc_ab47054d:w->registrar_6e1503e3:e - + - - - - + + + + fk_registrar_poc_registrar_id @@ -5252,6 +5268,11 @@ td.section { current_sponsor_registrar_id text + + + deletion_time + timestamptz + last_epp_update_registrar_id @@ -5267,6 +5288,11 @@ td.section { superordinate_domain text + + + inet_addresses + _text + diff --git a/db/src/main/resources/sql/er_diagram/full_er_diagram.html b/db/src/main/resources/sql/er_diagram/full_er_diagram.html index 2d1cd4275..26c80c5f8 100644 --- a/db/src/main/resources/sql/er_diagram/full_er_diagram.html +++ b/db/src/main/resources/sql/er_diagram/full_er_diagram.html @@ -261,11 +261,11 @@ td.section { generated on - 2022-03-07 15:27:20.810747 + 2022-03-07 19:59:39.894792 last flyway file - V107__add_billingevent_domainrepoid_indexes.sql + V108__add_host_indexes_for_whois.sql @@ -284,7 +284,7 @@ td.section { generated on - 2022-03-07 15:27:20.810747 + 2022-03-07 19:59:39.894792 @@ -11311,6 +11311,18 @@ td.section { + + idxrc77s1ndiemi2vwwudchye214 + [non-unique index] + + + + inet_addresses + ascending + + + + idxkpkh68n6dy5v51047yr6b0e9l [non-unique index] @@ -11332,6 +11344,18 @@ td.section { repo_id ascending + + + + + idxovmntef6l45tw2bsfl56tcugx + [non-unique index] + + + + deletion_time + ascending +

 

diff --git a/db/src/main/resources/sql/flyway.txt b/db/src/main/resources/sql/flyway.txt index 846276793..9659467f5 100644 --- a/db/src/main/resources/sql/flyway.txt +++ b/db/src/main/resources/sql/flyway.txt @@ -105,3 +105,4 @@ V104__add_transfer_response_host_id_to_poll_message.sql V105__add_index_on_host_name_in_host_table.sql V106__add_missing_indexes_from_query_analyzer.sql V107__add_billingevent_domainrepoid_indexes.sql +V108__add_host_indexes_for_whois.sql diff --git a/db/src/main/resources/sql/flyway/V108__add_host_indexes_for_whois.sql b/db/src/main/resources/sql/flyway/V108__add_host_indexes_for_whois.sql new file mode 100644 index 000000000..ea6b11f64 --- /dev/null +++ b/db/src/main/resources/sql/flyway/V108__add_host_indexes_for_whois.sql @@ -0,0 +1,17 @@ +-- Copyright 2022 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 IDXovmntef6l45tw2bsfl56tcugx ON "Host" (deletion_time); +CREATE INDEX IDXrc77s1ndiemi2vwwudchye214 ON "Host" (inet_addresses); diff --git a/db/src/main/resources/sql/schema/nomulus.golden.sql b/db/src/main/resources/sql/schema/nomulus.golden.sql index 89e3c9922..cabce7686 100644 --- a/db/src/main/resources/sql/schema/nomulus.golden.sql +++ b/db/src/main/resources/sql/schema/nomulus.golden.sql @@ -1854,6 +1854,13 @@ CREATE INDEX idxoqd7n4hbx86hvlgkilq75olas ON public."Contact" USING btree (conta CREATE INDEX idxoqttafcywwdn41um6kwlt0n8b ON public."BillingRecurrence" USING btree (domain_repo_id); +-- +-- Name: idxovmntef6l45tw2bsfl56tcugx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idxovmntef6l45tw2bsfl56tcugx ON public."Host" USING btree (deletion_time); + + -- -- Name: idxp3usbtvk0v1m14i5tdp4xnxgc; Type: INDEX; Schema: public; Owner: - -- @@ -1889,6 +1896,13 @@ CREATE INDEX idxqa3g92jc17e8dtiaviy4fet4x ON public."BillingCancellation" USING CREATE INDEX idxr22ciyccwi9rrqmt1ro0s59qf ON public."Domain" USING btree (tech_contact); +-- +-- Name: idxrc77s1ndiemi2vwwudchye214; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idxrc77s1ndiemi2vwwudchye214 ON public."Host" USING btree (inet_addresses); + + -- -- Name: idxrh4xmrot9bd63o382ow9ltfig; Type: INDEX; Schema: public; Owner: - --