Skip to content

Perform a few SQL optimizations on nameserver access; clean up a bit. #83

Merged
merged 1 commit into from Feb 23, 2012

2 participants

@jeremycole

The following migrations should be done to apply the indexing changes
and column order changes to existing nameservers:

ALTER TABLE shards
CHANGE hostname
hostname VARCHAR(125) NOT NULL AFTER class_name,
ADD INDEX idx_busy (busy);

ALTER TABLE shard_children
DROP INDEX child,
ADD INDEX idx_parent (parent_hostname, parent_table_prefix, weight),
ADD INDEX idx_child (child_hostname, child_table_prefix, weight);

ALTER TABLE forwardings
CHANGE base_source_id
base_source_id BIGINT NOT NULL AFTER table_id,
DROP PRIMARY KEY,
ADD PRIMARY KEY (table_id, base_source_id),
DROP INDEX unique_shard,
ADD UNIQUE uni_shard (shard_hostname, shard_table_prefix),
ADD INDEX idx_updated (updated_seq);

ALTER TABLE hosts
DROP INDEX cluster,
ADD INDEX idx_cluster (cluster, status);

@jeremycole jeremycole Perform a few SQL optimizations on nameserver access; clean up a bit.
The following migrations should be done to apply the indexing changes
and column order changes to existing nameservers:

ALTER TABLE shards
  CHANGE hostname
    hostname VARCHAR(125) NOT NULL AFTER class_name,
  ADD INDEX idx_busy (busy);

ALTER TABLE shard_children
  DROP INDEX child,
  ADD INDEX idx_parent (parent_hostname, parent_table_prefix, weight),
  ADD INDEX idx_child (child_hostname, child_table_prefix, weight);

ALTER TABLE forwardings
  CHANGE base_source_id
    base_source_id BIGINT NOT NULL AFTER table_id,
  DROP PRIMARY KEY,
  ADD PRIMARY KEY (table_id, base_source_id),
  DROP INDEX unique_shard,
  ADD UNIQUE uni_shard (shard_hostname, shard_table_prefix),
  ADD INDEX idx_updated  (updated_seq);

ALTER TABLE hosts
  DROP INDEX cluster,
  ADD INDEX idx_cluster (cluster, status);
d19e2c7
@freels freels merged commit 7f744d9 into twitter:master Feb 23, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.