Add 9 more indexes to SQL schema (#1540)

These indexes were identified as missing by PostgreSQL's query analyzer in our
sandbox environment (where we get enough realistic EPP traffic to identify these
deficiencies).

Note that a lot of the new indexes being named have to use the DB representation
of the column name because they are either embedded or subclassed entities,
whereas most of the existing ones are able to simply refer to Java field names.

This is the Java schema follow-up PR to PR #1541, which is what added the
actual DB changes through Flyway scripts.
This commit is contained in:
Ben McIlwain 2022-03-14 15:59:05 -04:00 committed by GitHub
parent a001df6d7a
commit 4bfa19a90c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 37 additions and 16 deletions

View file

@ -308,7 +308,8 @@ public abstract class BillingEvent extends ImmutableObject
@javax.persistence.Index(columnList = "eventTime"),
@javax.persistence.Index(columnList = "billingTime"),
@javax.persistence.Index(columnList = "syntheticCreationTime"),
@javax.persistence.Index(columnList = "allocationToken")
@javax.persistence.Index(columnList = "allocationToken"),
@javax.persistence.Index(columnList = "cancellation_matching_billing_recurrence_id")
})
@AttributeOverride(name = "id", column = @Column(name = "billing_event_id"))
@WithLongVKey(compositeKey = true)
@ -614,7 +615,9 @@ public abstract class BillingEvent extends ImmutableObject
indexes = {
@javax.persistence.Index(columnList = "registrarId"),
@javax.persistence.Index(columnList = "eventTime"),
@javax.persistence.Index(columnList = "billingTime")
@javax.persistence.Index(columnList = "billingTime"),
@javax.persistence.Index(columnList = "billing_event_id"),
@javax.persistence.Index(columnList = "billing_recurrence_id")
})
@AttributeOverride(name = "id", column = @Column(name = "billing_cancellation_id"))
@WithLongVKey(compositeKey = true)

View file

@ -69,7 +69,10 @@ import org.joda.time.DateTime;
@Index(columnList = "techContact"),
@Index(columnList = "tld"),
@Index(columnList = "registrantContact"),
@Index(columnList = "dnsRefreshRequestTime")
@Index(columnList = "dnsRefreshRequestTime"),
@Index(columnList = "billing_recurrence_id"),
@Index(columnList = "transfer_billing_event_id"),
@Index(columnList = "transfer_billing_recurrence_id")
})
@WithStringVKey
@ExternalMessagingName("domain")
@ -89,7 +92,10 @@ public class DomainBase extends DomainContent
@ElementCollection
@JoinTable(
name = "DomainHost",
indexes = {@Index(columnList = "domain_repo_id,host_repo_id", unique = true)})
indexes = {
@Index(columnList = "domain_repo_id,host_repo_id", unique = true),
@Index(columnList = "host_repo_id")
})
@Access(AccessType.PROPERTY)
@Column(name = "host_repo_id")
public Set<VKey<HostResource>> getNsHosts() {

View file

@ -46,7 +46,12 @@ import org.joda.time.DateTime;
*/
@Embed
@Entity
@Table(indexes = @Index(columnList = "domainRepoId"))
@Table(
indexes = {
@Index(columnList = "domainRepoId"),
@Index(columnList = "billing_event_id"),
@Index(columnList = "billing_recurrence_id")
})
public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntity {
@Id

View file

@ -94,8 +94,6 @@ public class DomainTransferData extends TransferData<DomainTransferData.Builder>
*
* <p>This field should be null if there is not currently a pending transfer or if the object
* being transferred is not a domain.
*
* <p>TODO(b/158230654) Remove unused columns for TransferData in Contact table.
*/
@IgnoreSave(IfNull.class)
@Column(name = "transfer_billing_event_id")