buildfarmjob schema is inefficient for reporting

Bug #758258 reported by Robert Collins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Critical
William Grant

Bug Description

We do queries like 'what packages failed to build ordered by date'. Bugs like bug 730396 bug 739066 bug 739065 may/are symptoms of this.

Broadly when the following is true:
 - the dataset in a table is larger than we want to evaluate & sort every page load (implies we want an index for sorted results)
then
 - we need to be able to filter the results for any query to a sensible subset on that table

This is because when there is an index matching the sort order, postgresql will strongly prefer to iterate that rather than loading all the results and doing an in-memory sort.

The BuildFarmJob collection:
BuildFarmJob(BFJ)->PackageBuild(PB)->BinaryPackageBuild(BPB)
BuildFarmJob(BFJ)->PackageBuild(PB)->SourcePackageRecipeBuild(SPRB)
BuildFarmJob(BFJ)->TranslationTemplatesBuild(TTB)

fails the 'able to filter' criteria: these three different combinations always appear together:
BPB always has a PB always has a BFJ
DPRB always has a PB always has a BFJ
TTB always has a BFJ

But the filtering (e.g. on branch for TTB) is separated from the ordering (e.g. date in BFJ).

As these three combinations act as a single object consistently, the simplest thing is to fold them all together: roll BFJ+PB into PBP, roll BFJ+PB into SPRB and roll BFJ into TTB.

BFJ is 200MB (2M rows)
PB is 100MB (2M rows)
BPB is 91MB (2M rows)
SPRB is < 1MB (20K rows)
TTB is < 1MB (4300 rows)

SPRB and TTB could be migrated during downtime, but the BPB migration will have to be done online via a garbo migration script.

Related branches

Curtis Hovey (sinzui)
Changed in launchpad:
assignee: nobody → Launchpad Green Squad (launchpad-green-squad)
William Grant (wgrant)
Changed in launchpad:
assignee: Launchpad Green Squad (launchpad-green-squad) → William Grant (wgrant)
status: Triaged → In Progress
Curtis Hovey (sinzui)
Changed in launchpad:
assignee: William Grant (wgrant) → nobody
Revision history for this message
William Grant (wgrant) wrote :

I've landed the migration that can be deployed before the next DB downtime. Before that downtime we should add new columns (part of the patches in the attached branches), with triggers and garbo jobs to populate them. Then the remaining bits of these two branches should land, migrating to the new flat tables.

William Grant (wgrant)
Changed in launchpad:
status: In Progress → Triaged
tags: added: analysis critical
tags: added: critical-analysus
removed: analysis critical
tags: added: critical-analysis
removed: critical-analysus
William Grant (wgrant)
Changed in launchpad:
assignee: nobody → William Grant (wgrant)
status: Triaged → In Progress
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
Revision history for this message
William Grant (wgrant) wrote :

2013-02-03 06:52:15,268 INFO 2209-41-0 applied just now in 0.0 seconds

tags: added: qa-ok
removed: qa-needstesting
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
removed: qa-ok
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
William Grant (wgrant)
tags: added: qa-ok
removed: qa-needstesting
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
removed: qa-ok
William Grant (wgrant)
tags: added: qa-ok
removed: qa-needstesting
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
removed: qa-ok
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
William Grant (wgrant)
tags: added: qa-ok
removed: qa-needstesting
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
removed: qa-ok
William Grant (wgrant)
tags: added: qa-ok
removed: qa-needstesting
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
removed: qa-ok
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
Changed in launchpad:
status: In Progress → Fix Committed
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
William Grant (wgrant)
tags: added: qa-ok
removed: qa-needstesting
Steve Kowalik (stevenk)
Changed in launchpad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.