From b6b39f4e0053a21a353403fa37e233556a1e13cc Mon Sep 17 00:00:00 2001 From: Gus Brodman Date: Mon, 9 Dec 2024 17:13:02 -0500 Subject: [PATCH] Drop FKs referencing DomainHistory - We never delete rows from DomainHistory (and even if we do in the future, they'll be old / the references won't matter) - This is likely creating lock contention when lots of requests come through at once for domains with many DomainHistory entries --- .../model/billing/BillingCancellation.java | 3 +- .../registry/model/billing/BillingEvent.java | 4 +- .../model/billing/BillingRecurrence.java | 3 +- .../registry/model/domain/GracePeriod.java | 2 +- .../domain/secdns/DomainDsDataHistory.java | 3 + .../registry/model/poll/PollMessage.java | 5 +- .../reporting/DomainTransactionRecord.java | 3 + db/src/main/resources/sql/flyway.txt | 7 + ...ve_fk_graceperiodhistory_domainhistory.sql | 16 +++ ...e_fk_billingcancellation_domainhistory.sql | 16 +++ ...__remove_fk_billingevent_domainhistory.sql | 18 +++ ...ove_fk_billingrecurrence_domainhistory.sql | 16 +++ ...4__remove_fk_pollmessage_domainhistory.sql | 16 +++ ..._domaintransactionrecord_domainhistory.sql | 16 +++ ...e_fk_domaindsdatahistory_domainhistory.sql | 16 +++ .../sql/schema/db-schema.sql.generated | 28 +++- .../resources/sql/schema/nomulus.golden.sql | 120 ++++++++---------- 17 files changed, 220 insertions(+), 72 deletions(-) create mode 100644 db/src/main/resources/sql/flyway/V180__remove_fk_graceperiodhistory_domainhistory.sql create mode 100644 db/src/main/resources/sql/flyway/V181__remove_fk_billingcancellation_domainhistory.sql create mode 100644 db/src/main/resources/sql/flyway/V182__remove_fk_billingevent_domainhistory.sql create mode 100644 db/src/main/resources/sql/flyway/V183__remove_fk_billingrecurrence_domainhistory.sql create mode 100644 db/src/main/resources/sql/flyway/V184__remove_fk_pollmessage_domainhistory.sql create mode 100644 db/src/main/resources/sql/flyway/V185__remove_fk_domaintransactionrecord_domainhistory.sql create mode 100644 db/src/main/resources/sql/flyway/V186__remove_fk_domaindsdatahistory_domainhistory.sql diff --git a/core/src/main/java/google/registry/model/billing/BillingCancellation.java b/core/src/main/java/google/registry/model/billing/BillingCancellation.java index 410af5b7ccf..404b103dac7 100644 --- a/core/src/main/java/google/registry/model/billing/BillingCancellation.java +++ b/core/src/main/java/google/registry/model/billing/BillingCancellation.java @@ -46,7 +46,8 @@ @Index(columnList = "domainRepoId"), @Index(columnList = "billingTime"), @Index(columnList = "billing_event_id"), - @Index(columnList = "billing_recurrence_id") + @Index(columnList = "billing_recurrence_id"), + @Index(columnList = "domainRepoId,domainHistoryRevisionId") }) @AttributeOverride(name = "id", column = @Column(name = "billing_cancellation_id")) @WithVKey(Long.class) diff --git a/core/src/main/java/google/registry/model/billing/BillingEvent.java b/core/src/main/java/google/registry/model/billing/BillingEvent.java index 3e73d5e3600..52a19cdd06e 100644 --- a/core/src/main/java/google/registry/model/billing/BillingEvent.java +++ b/core/src/main/java/google/registry/model/billing/BillingEvent.java @@ -42,7 +42,9 @@ @Index(columnList = "syntheticCreationTime"), @Index(columnList = "domainRepoId"), @Index(columnList = "allocationToken"), - @Index(columnList = "cancellation_matching_billing_recurrence_id") + @Index(columnList = "cancellation_matching_billing_recurrence_id"), + @Index(columnList = "domainRepoId,domainHistoryRevisionId"), + @Index(columnList = "domainRepoId,recurrenceHistoryRevisionId") }) @AttributeOverride(name = "id", column = @Column(name = "billing_event_id")) @WithVKey(Long.class) diff --git a/core/src/main/java/google/registry/model/billing/BillingRecurrence.java b/core/src/main/java/google/registry/model/billing/BillingRecurrence.java index 67730f62ad5..5eb3a8970a4 100644 --- a/core/src/main/java/google/registry/model/billing/BillingRecurrence.java +++ b/core/src/main/java/google/registry/model/billing/BillingRecurrence.java @@ -50,7 +50,8 @@ @Index(columnList = "domainRepoId"), @Index(columnList = "recurrenceEndTime"), @Index(columnList = "recurrenceLastExpansion"), - @Index(columnList = "recurrence_time_of_year") + @Index(columnList = "recurrenceTimeOfYear"), + @Index(columnList = "domainRepoId,domainHistoryRevisionId") }) @AttributeOverride(name = "id", column = @Column(name = "billing_recurrence_id")) @WithVKey(Long.class) diff --git a/core/src/main/java/google/registry/model/domain/GracePeriod.java b/core/src/main/java/google/registry/model/domain/GracePeriod.java index 1e7673b0822..003bf2cada4 100644 --- a/core/src/main/java/google/registry/model/domain/GracePeriod.java +++ b/core/src/main/java/google/registry/model/domain/GracePeriod.java @@ -180,7 +180,7 @@ public static GracePeriod forBillingEvent( /** Entity class to represent a historic {@link GracePeriod}. */ @Entity(name = "GracePeriodHistory") - @Table(indexes = @Index(columnList = "domainRepoId")) + @Table(indexes = {@Index(columnList = "domainRepoId"), @Index(columnList = "domainRepoId,domainHistoryRevisionId")}) public static class GracePeriodHistory extends GracePeriodBase { @Id Long gracePeriodHistoryRevisionId; diff --git a/core/src/main/java/google/registry/model/domain/secdns/DomainDsDataHistory.java b/core/src/main/java/google/registry/model/domain/secdns/DomainDsDataHistory.java index fc2f109d922..91e134e6c84 100644 --- a/core/src/main/java/google/registry/model/domain/secdns/DomainDsDataHistory.java +++ b/core/src/main/java/google/registry/model/domain/secdns/DomainDsDataHistory.java @@ -23,9 +23,12 @@ import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Id; +import jakarta.persistence.Index; +import jakarta.persistence.Table; /** Entity class to represent a historic {@link DomainDsData}. */ @Entity +@Table(indexes = @Index(columnList = "domainRepoId,domainHistoryRevisionId")) public class DomainDsDataHistory extends DomainDsDataBase { @Id Long dsDataHistoryRevisionId; diff --git a/core/src/main/java/google/registry/model/poll/PollMessage.java b/core/src/main/java/google/registry/model/poll/PollMessage.java index ed9f82e0004..06a9d957cd5 100644 --- a/core/src/main/java/google/registry/model/poll/PollMessage.java +++ b/core/src/main/java/google/registry/model/poll/PollMessage.java @@ -89,8 +89,9 @@ @Table( indexes = { @Index(columnList = "domainRepoId"), - @Index(columnList = "registrar_id"), - @Index(columnList = "eventTime") + @Index(columnList = "registrarId"), + @Index(columnList = "eventTime"), + @Index(columnList = "domainRepoId,domainHistoryRevisionId") }) public abstract class PollMessage extends ImmutableObject implements Buildable, TransferServerApproveEntity, UnsafeSerializable { diff --git a/core/src/main/java/google/registry/model/reporting/DomainTransactionRecord.java b/core/src/main/java/google/registry/model/reporting/DomainTransactionRecord.java index 89da52277ce..1f4b3ad6159 100644 --- a/core/src/main/java/google/registry/model/reporting/DomainTransactionRecord.java +++ b/core/src/main/java/google/registry/model/reporting/DomainTransactionRecord.java @@ -29,6 +29,8 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; +import jakarta.persistence.Index; +import jakarta.persistence.Table; import org.joda.time.DateTime; /** @@ -42,6 +44,7 @@ * uses HistoryEntry.otherClientId because the losing party in a transfer is always the otherClient. */ @Entity +@Table(indexes = @Index(columnList = "domainRepoId,historyRevisionId")) public class DomainTransactionRecord extends ImmutableObject implements Buildable, UnsafeSerializable { diff --git a/db/src/main/resources/sql/flyway.txt b/db/src/main/resources/sql/flyway.txt index b08e0a5e3f2..4b8fda46d40 100644 --- a/db/src/main/resources/sql/flyway.txt +++ b/db/src/main/resources/sql/flyway.txt @@ -177,3 +177,10 @@ V176__drop_login_email_address_column_from_registrar_poc.sql V177__drop_user_id.sql V178__drop_user_id_history.sql V179__add_discount_price_allocation_token.sql +V180__remove_fk_graceperiodhistory_domainhistory.sql +V181__remove_fk_billingcancellation_domainhistory.sql +V182__remove_fk_billingevent_domainhistory.sql +V183__remove_fk_billingrecurrence_domainhistory.sql +V184__remove_fk_pollmessage_domainhistory.sql +V185__remove_fk_domaintransactionrecord_domainhistory.sql +V186__remove_fk_domaindsdatahistory_domainhistory.sql diff --git a/db/src/main/resources/sql/flyway/V180__remove_fk_graceperiodhistory_domainhistory.sql b/db/src/main/resources/sql/flyway/V180__remove_fk_graceperiodhistory_domainhistory.sql new file mode 100644 index 00000000000..ab61ee8e77d --- /dev/null +++ b/db/src/main/resources/sql/flyway/V180__remove_fk_graceperiodhistory_domainhistory.sql @@ -0,0 +1,16 @@ +-- Copyright 2024 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. + +ALTER TABLE "GracePeriodHistory" DROP CONSTRAINT fk7w3cx8d55q8bln80e716tr7b8; +CREATE INDEX IDXl67y6wclc2uaupepnvkoo81fl on "GracePeriodHistory" (domain_repo_id, domain_history_revision_id); diff --git a/db/src/main/resources/sql/flyway/V181__remove_fk_billingcancellation_domainhistory.sql b/db/src/main/resources/sql/flyway/V181__remove_fk_billingcancellation_domainhistory.sql new file mode 100644 index 00000000000..53bdf29b61c --- /dev/null +++ b/db/src/main/resources/sql/flyway/V181__remove_fk_billingcancellation_domainhistory.sql @@ -0,0 +1,16 @@ +-- Copyright 2024 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. + +ALTER TABLE "BillingCancellation" DROP CONSTRAINT fk_billing_cancellation_domain_history; +CREATE INDEX IDX7v75e535c47mxfb2rk9o843bn ON"BillingCancellation" (domain_repo_id, domain_history_revision_id); diff --git a/db/src/main/resources/sql/flyway/V182__remove_fk_billingevent_domainhistory.sql b/db/src/main/resources/sql/flyway/V182__remove_fk_billingevent_domainhistory.sql new file mode 100644 index 00000000000..14fb791fca4 --- /dev/null +++ b/db/src/main/resources/sql/flyway/V182__remove_fk_billingevent_domainhistory.sql @@ -0,0 +1,18 @@ +-- Copyright 2024 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. + +ALTER TABLE "BillingEvent" DROP CONSTRAINT fk_billing_event_domain_history; +ALTER TABLE "BillingEvent" DROP CONSTRAINT fk_billing_event_recurrence_history; +CREATE INDEX IDX77ceolnf7rok8ui957msmo6en ON "BillingEvent" (domain_repo_id, domain_history_revision_id); +CREATE INDEX IDXehp8ejwpbsooar0e8k32847m3 ON "BillingEvent" (domain_repo_id, recurrence_history_revision_id); diff --git a/db/src/main/resources/sql/flyway/V183__remove_fk_billingrecurrence_domainhistory.sql b/db/src/main/resources/sql/flyway/V183__remove_fk_billingrecurrence_domainhistory.sql new file mode 100644 index 00000000000..21632e7e7d0 --- /dev/null +++ b/db/src/main/resources/sql/flyway/V183__remove_fk_billingrecurrence_domainhistory.sql @@ -0,0 +1,16 @@ +-- Copyright 2024 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. + +ALTER TABLE "BillingRecurrence" DROP CONSTRAINT fk_billing_recurrence_domain_history; +CREATE INDEX IDXlh9lvmxb2dj3ti83buauwvbil ON "BillingRecurrence" (domain_repo_id, domain_history_revision_id); diff --git a/db/src/main/resources/sql/flyway/V184__remove_fk_pollmessage_domainhistory.sql b/db/src/main/resources/sql/flyway/V184__remove_fk_pollmessage_domainhistory.sql new file mode 100644 index 00000000000..2fac8e62cec --- /dev/null +++ b/db/src/main/resources/sql/flyway/V184__remove_fk_pollmessage_domainhistory.sql @@ -0,0 +1,16 @@ +-- Copyright 2024 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. + +ALTER TABLE "PollMessage" DROP CONSTRAINT fk_poll_message_domain_history; +CREATE INDEX IDXfkg5lrxr5yg54jpii25a17v53 ON "PollMessage" (domain_repo_id, domain_history_revision_id); diff --git a/db/src/main/resources/sql/flyway/V185__remove_fk_domaintransactionrecord_domainhistory.sql b/db/src/main/resources/sql/flyway/V185__remove_fk_domaintransactionrecord_domainhistory.sql new file mode 100644 index 00000000000..5baa2e016fe --- /dev/null +++ b/db/src/main/resources/sql/flyway/V185__remove_fk_domaintransactionrecord_domainhistory.sql @@ -0,0 +1,16 @@ +-- Copyright 2024 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. + +ALTER TABLE "DomainTransactionRecord" DROP CONSTRAINT "fkcjqe54u72kha71vkibvxhjye7"; +CREATE INDEX IDX1dyqmqb61xbnj7mt7bk27ds25 ON "DomainTransactionRecord" (domain_repo_id, history_revision_id); diff --git a/db/src/main/resources/sql/flyway/V186__remove_fk_domaindsdatahistory_domainhistory.sql b/db/src/main/resources/sql/flyway/V186__remove_fk_domaindsdatahistory_domainhistory.sql new file mode 100644 index 00000000000..5a4cbcab2c1 --- /dev/null +++ b/db/src/main/resources/sql/flyway/V186__remove_fk_domaindsdatahistory_domainhistory.sql @@ -0,0 +1,16 @@ +-- Copyright 2024 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. + +ALTER TABLE "DomainDsDataHistory" DROP CONSTRAINT fko4ilgyyfnvppbpuivus565i0j; +CREATE INDEX IDXmk1d2ngdtfkg6odmw7l5ejisw ON "DomainDsDataHistory" (domain_repo_id, domain_history_revision_id); diff --git a/db/src/main/resources/sql/schema/db-schema.sql.generated b/db/src/main/resources/sql/schema/db-schema.sql.generated index d97b158fab2..e2de3a6833b 100644 --- a/db/src/main/resources/sql/schema/db-schema.sql.generated +++ b/db/src/main/resources/sql/schema/db-schema.sql.generated @@ -947,6 +947,9 @@ create index IDXku0fopwyvd57ebo8bf0jg9xo2 on "BillingCancellation" (billing_recurrence_id); + create index IDX7v75e535c47mxfb2rk9o843bn + on "BillingCancellation" (domain_repo_id, domain_history_revision_id); + create index IDXqspv57gj2led8ly42fq01t7m7 on "BillingEvent" (registrar_id); @@ -968,6 +971,12 @@ create index IDX6ebt3nwk5ocvnremnhnlkl6ff on "BillingEvent" (cancellation_matching_billing_recurrence_id); + create index IDX77ceolnf7rok8ui957msmo6en + on "BillingEvent" (domain_repo_id, domain_history_revision_id); + + create index IDXehp8ejwpbsooar0e8k32847m3 + on "BillingEvent" (domain_repo_id, recurrence_history_revision_id); + create index IDXd3gxhkh0jk694pjvh9pyn7wjc on "BillingRecurrence" (registrar_id); @@ -983,9 +992,12 @@ create index IDXp0pxi708hlu4n40qhbtihge8x on "BillingRecurrence" (recurrence_last_expansion); - create index IDXjny8wuot75b5e6p38r47wdawu + create index IDXbix949l2kfn9r03l6omyhi36f on "BillingRecurrence" (recurrence_time_of_year); + create index IDXlh9lvmxb2dj3ti83buauwvbil + on "BillingRecurrence" (domain_repo_id, domain_history_revision_id); + create index IDXj874kw19bgdnkxo1rue45jwlw on "BsaDownload" (creation_time); @@ -1079,6 +1091,9 @@ create index IDXhteajcrxmq4o8rsys8kevyiqr on "Domain" (transfer_billing_cancellation_id); + create index IDXmk1d2ngdtfkg6odmw7l5ejisw + on "DomainDsDataHistory" (domain_repo_id, domain_history_revision_id); + create index IDXrh4xmrot9bd63o382ow9ltfig on "DomainHistory" (creation_time); @@ -1097,6 +1112,9 @@ create index IDXjw3rwtfrexyq53x9vu7qghrdt on "DomainHost" (host_repo_id); + create index IDX1dyqmqb61xbnj7mt7bk27ds25 + on "DomainTransactionRecord" (domain_repo_id, history_revision_id); + create index IDXj1mtx98ndgbtb1bkekahms18w on "GracePeriod" (domain_repo_id); @@ -1109,6 +1127,9 @@ create index IDXd01j17vrpjxaerxdmn8bwxs7s on "GracePeriodHistory" (domain_repo_id); + create index IDXl67y6wclc2uaupepnvkoo81fl + on "GracePeriodHistory" (domain_repo_id, domain_history_revision_id); + create index IDXkpkh68n6dy5v51047yr6b0e9l on "Host" (host_name); @@ -1145,12 +1166,15 @@ create index IDXf2q9dqj899h1q8lah5y719nxd on "PollMessage" (domain_repo_id); - create index IDXe7wu46c7wpvfmfnj4565abibp + create index IDXb75725p8js6987ubi8a7nhdqs on "PollMessage" (registrar_id); create index IDXaydgox62uno9qx8cjlj5lauye on "PollMessage" (event_time); + create index IDXfkg5lrxr5yg54jpii25a17v53 + on "PollMessage" (domain_repo_id, domain_history_revision_id); + create index premiumlist_name_idx on "PremiumList" (name); diff --git a/db/src/main/resources/sql/schema/nomulus.golden.sql b/db/src/main/resources/sql/schema/nomulus.golden.sql index 82dc98d51f3..14ed1ae551c 100644 --- a/db/src/main/resources/sql/schema/nomulus.golden.sql +++ b/db/src/main/resources/sql/schema/nomulus.golden.sql @@ -1862,6 +1862,13 @@ CREATE INDEX domain_history_to_ds_data_history_idx ON public."DomainDsDataHistor CREATE INDEX domain_history_to_transaction_record_idx ON public."DomainTransactionRecord" USING btree (domain_repo_id, history_revision_id); +-- +-- Name: idx1dyqmqb61xbnj7mt7bk27ds25; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idx1dyqmqb61xbnj7mt7bk27ds25 ON public."DomainTransactionRecord" USING btree (domain_repo_id, history_revision_id); + + -- -- Name: idx1iy7njgb7wjmj9piml4l2g0qi; Type: INDEX; Schema: public; Owner: - -- @@ -2002,6 +2009,20 @@ CREATE INDEX idx6y67d6wsffmr6jcxax5ghwqhd ON public."ConsoleEppActionHistory" US CREATE INDEX idx73l103vc5900ig3p4odf0cngt ON public."BillingEvent" USING btree (registrar_id); +-- +-- Name: idx77ceolnf7rok8ui957msmo6en; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idx77ceolnf7rok8ui957msmo6en ON public."BillingEvent" USING btree (domain_repo_id, domain_history_revision_id); + + +-- +-- Name: idx7v75e535c47mxfb2rk9o843bn; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idx7v75e535c47mxfb2rk9o843bn ON public."BillingCancellation" USING btree (domain_repo_id, domain_history_revision_id); + + -- -- Name: idx8gtvnbk64yskcvrdp61f5ied3; Type: INDEX; Schema: public; Owner: - -- @@ -2121,6 +2142,13 @@ CREATE INDEX idxd01j17vrpjxaerxdmn8bwxs7s ON public."GracePeriodHistory" USING b CREATE INDEX idxe7wu46c7wpvfmfnj4565abibp ON public."PollMessage" USING btree (registrar_id); +-- +-- Name: idxehp8ejwpbsooar0e8k32847m3; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idxehp8ejwpbsooar0e8k32847m3 ON public."BillingEvent" USING btree (domain_repo_id, recurrence_history_revision_id); + + -- -- Name: idxeokttmxtpq2hohcioe5t2242b; Type: INDEX; Schema: public; Owner: - -- @@ -2149,6 +2177,13 @@ CREATE INDEX idxfdk2xpil2x1gh0omt84k2y3o1 ON public."DnsRefreshRequest" USING bt CREATE INDEX idxfg2nnjlujxo6cb9fha971bq2n ON public."HostHistory" USING btree (creation_time); +-- +-- Name: idxfkg5lrxr5yg54jpii25a17v53; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idxfkg5lrxr5yg54jpii25a17v53 ON public."PollMessage" USING btree (domain_repo_id, domain_history_revision_id); + + -- -- Name: idxfr24wvpg8qalwqy4pni7evrpj; Type: INDEX; Schema: public; Owner: - -- @@ -2261,6 +2296,13 @@ CREATE INDEX idxku0fopwyvd57ebo8bf0jg9xo2 ON public."BillingCancellation" USING CREATE INDEX idxl49vydnq0h5j1piefwjy4i8er ON public."Host" USING btree (current_sponsor_registrar_id); +-- +-- Name: idxl67y6wclc2uaupepnvkoo81fl; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idxl67y6wclc2uaupepnvkoo81fl ON public."GracePeriodHistory" USING btree (domain_repo_id, domain_history_revision_id); + + -- -- Name: idxl8vobbecsd32k4ksavdfx8st6; Type: INDEX; Schema: public; Owner: - -- @@ -2275,6 +2317,13 @@ CREATE INDEX idxl8vobbecsd32k4ksavdfx8st6 ON public."BillingCancellation" USING CREATE INDEX idxlg6a5tp70nch9cp0gc11brc5o ON public."PackagePromotion" USING btree (token); +-- +-- Name: idxlh9lvmxb2dj3ti83buauwvbil; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idxlh9lvmxb2dj3ti83buauwvbil ON public."BillingRecurrence" USING btree (domain_repo_id, domain_history_revision_id); + + -- -- Name: idxlrq7v63pc21uoh3auq6eybyhl; Type: INDEX; Schema: public; Owner: - -- @@ -2289,6 +2338,13 @@ CREATE INDEX idxlrq7v63pc21uoh3auq6eybyhl ON public."Domain" USING btree (autore CREATE INDEX idxm6k18dusy2lfi5y81k8g256sa ON public."RegistrarUpdateHistory" USING btree (history_acting_user); +-- +-- Name: idxmk1d2ngdtfkg6odmw7l5ejisw; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idxmk1d2ngdtfkg6odmw7l5ejisw ON public."DomainDsDataHistory" USING btree (domain_repo_id, domain_history_revision_id); + + -- -- Name: idxn1f711wicdnooa2mqb7g1m55o; Type: INDEX; Schema: public; Owner: - -- @@ -2569,14 +2625,6 @@ ALTER TABLE ONLY public."ClaimsEntry" ADD CONSTRAINT fk6sc6at5hedffc0nhdcab6ivuq FOREIGN KEY (revision_id) REFERENCES public."ClaimsList"(revision_id) DEFERRABLE INITIALLY DEFERRED; --- --- Name: GracePeriodHistory fk7w3cx8d55q8bln80e716tr7b8; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public."GracePeriodHistory" - ADD CONSTRAINT fk7w3cx8d55q8bln80e716tr7b8 FOREIGN KEY (domain_repo_id, domain_history_revision_id) REFERENCES public."DomainHistory"(domain_repo_id, history_revision_id) DEFERRABLE INITIALLY DEFERRED; - - -- -- Name: Contact fk93c185fx7chn68uv7nl6uv2s0; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -2601,14 +2649,6 @@ ALTER TABLE ONLY public."BillingCancellation" ADD CONSTRAINT fk_billing_cancellation_billing_recurrence_id FOREIGN KEY (billing_recurrence_id) REFERENCES public."BillingRecurrence"(billing_recurrence_id) DEFERRABLE INITIALLY DEFERRED; --- --- Name: BillingCancellation fk_billing_cancellation_domain_history; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public."BillingCancellation" - ADD CONSTRAINT fk_billing_cancellation_domain_history FOREIGN KEY (domain_repo_id, domain_history_revision_id) REFERENCES public."DomainHistory"(domain_repo_id, history_revision_id) DEFERRABLE INITIALLY DEFERRED; - - -- -- Name: BillingCancellation fk_billing_cancellation_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -2633,22 +2673,6 @@ ALTER TABLE ONLY public."BillingEvent" ADD CONSTRAINT fk_billing_event_cancellation_matching_billing_recurrence_id FOREIGN KEY (cancellation_matching_billing_recurrence_id) REFERENCES public."BillingRecurrence"(billing_recurrence_id) DEFERRABLE INITIALLY DEFERRED; --- --- Name: BillingEvent fk_billing_event_domain_history; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public."BillingEvent" - ADD CONSTRAINT fk_billing_event_domain_history FOREIGN KEY (domain_repo_id, domain_history_revision_id) REFERENCES public."DomainHistory"(domain_repo_id, history_revision_id) DEFERRABLE INITIALLY DEFERRED; - - --- --- Name: BillingEvent fk_billing_event_recurrence_history; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public."BillingEvent" - ADD CONSTRAINT fk_billing_event_recurrence_history FOREIGN KEY (domain_repo_id, recurrence_history_revision_id) REFERENCES public."DomainHistory"(domain_repo_id, history_revision_id) DEFERRABLE INITIALLY DEFERRED; - - -- -- Name: BillingEvent fk_billing_event_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -2657,14 +2681,6 @@ ALTER TABLE ONLY public."BillingEvent" ADD CONSTRAINT fk_billing_event_registrar_id FOREIGN KEY (registrar_id) REFERENCES public."Registrar"(registrar_id) DEFERRABLE INITIALLY DEFERRED; --- --- Name: BillingRecurrence fk_billing_recurrence_domain_history; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public."BillingRecurrence" - ADD CONSTRAINT fk_billing_recurrence_domain_history FOREIGN KEY (domain_repo_id, domain_history_revision_id) REFERENCES public."DomainHistory"(domain_repo_id, history_revision_id) DEFERRABLE INITIALLY DEFERRED; - - -- -- Name: BillingRecurrence fk_billing_recurrence_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -2937,14 +2953,6 @@ ALTER TABLE ONLY public."PollMessage" ADD CONSTRAINT fk_poll_message_contact_repo_id FOREIGN KEY (contact_repo_id) REFERENCES public."Contact"(repo_id) DEFERRABLE INITIALLY DEFERRED; --- --- Name: PollMessage fk_poll_message_domain_history; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public."PollMessage" - ADD CONSTRAINT fk_poll_message_domain_history FOREIGN KEY (domain_repo_id, domain_history_revision_id) REFERENCES public."DomainHistory"(domain_repo_id, history_revision_id) DEFERRABLE INITIALLY DEFERRED; - - -- -- Name: PollMessage fk_poll_message_domain_repo_id; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -3025,14 +3033,6 @@ ALTER TABLE ONLY public."BsaUnblockableDomain" ADD CONSTRAINT fkbsaunblockabledomainlabel FOREIGN KEY (label) REFERENCES public."BsaLabel"(label) ON DELETE CASCADE; --- --- Name: DomainTransactionRecord fkcjqe54u72kha71vkibvxhjye7; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public."DomainTransactionRecord" - ADD CONSTRAINT fkcjqe54u72kha71vkibvxhjye7 FOREIGN KEY (domain_repo_id, history_revision_id) REFERENCES public."DomainHistory"(domain_repo_id, history_revision_id) DEFERRABLE INITIALLY DEFERRED; - - -- -- Name: DomainHost fkfmi7bdink53swivs390m2btxg; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -3081,14 +3081,6 @@ ALTER TABLE ONLY public."PremiumEntry" ADD CONSTRAINT fko0gw90lpo1tuee56l0nb6y6g5 FOREIGN KEY (revision_id) REFERENCES public."PremiumList"(revision_id) DEFERRABLE INITIALLY DEFERRED; --- --- Name: DomainDsDataHistory fko4ilgyyfnvppbpuivus565i0j; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public."DomainDsDataHistory" - ADD CONSTRAINT fko4ilgyyfnvppbpuivus565i0j FOREIGN KEY (domain_repo_id, domain_history_revision_id) REFERENCES public."DomainHistory"(domain_repo_id, history_revision_id) DEFERRABLE INITIALLY DEFERRED; - - -- -- Name: RegistrarPocUpdateHistory fkregistrarpocupdatehistoryemailaddress; Type: FK CONSTRAINT; Schema: public; Owner: - --