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

Merged
merged 1 commit into from Feb 23, 2012

Conversation

Projects
None yet
2 participants
@jeremycole
Contributor

jeremycole commented Feb 14, 2012

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);

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);

freels added a commit that referenced this pull request Feb 23, 2012

Merge pull request #83 from jeremycole/nameserver_sql_optimization
Perform a few SQL optimizations on nameserver access; clean up a bit.

@freels freels merged commit 7f744d9 into twitter-archive:master Feb 23, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment