1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 16:30:59 +01:00

Improve GC performance for Herald Transcripts

Summary: This has to table scan a ginormous table right now, give it a fighting
chance with a more usable key.
Test Plan:
  - Launched GC daemon, no errors.
  - Used test console to create a new transcript.
  - Viewed some old transcripts.
  - Ran EXPLAIN on the SELECT and verified it was utilizing the garbageCollected
key.

Reviewed By: jungejason
Reviewers: jungejason, tuomaspelkonen, aran
CC: aran, epriestley, jungejason
Differential Revision: 735
This commit is contained in:
epriestley 2011-07-26 18:11:54 -07:00
parent 4efd36ccf5
commit 879431fb50
2 changed files with 12 additions and 2 deletions

View file

@ -0,0 +1,9 @@
ALTER TABLE phabricator_herald.herald_transcript
ADD garbageCollected BOOL NOT NULL DEFAULT 0;
UPDATE phabricator_herald.herald_transcript
SET garbageCollected = 1
WHERE objectTranscript = "";
ALTER TABLE phabricator_herald.herald_transcript
ADD KEY (garbageCollected, time);

View file

@ -104,8 +104,9 @@ class PhabricatorGarbageCollectorDaemon extends PhabricatorDaemon {
objectTranscript = "",
ruleTranscripts = "",
conditionTranscripts = "",
applyTranscripts = ""
WHERE `time` < %d AND objectTranscript != ""
applyTranscripts = "",
garbageCollected = 1
WHERE garbageCollected = 0 AND `time` < %d
LIMIT 100',
$table->getTableName(),
time() - $ttl);