Comment 2 for bug 739070

Revision history for this message
Robert Collins (lifeless) wrote : Re: Archive:+repository-size timeout

A variant that examines slightly less rows

explain analyze SELECT DISTINCT LibraryFileContent.datecreated,
                LibraryFileContent.filesize,
                LibraryFileContent.id,
                LibraryFileContent.md5,
                LibraryFileContent.sha1
FROM BinaryPackageFile,
     BinaryPackagePublishingHistory,
     LibraryFileAlias,
     LibraryFileContent
WHERE BinaryPackagePublishingHistory.archive = 14516
  AND BinaryPackagePublishingHistory.dateremoved IS NULL
  AND BinaryPackagePublishingHistory.binarypackagerelease = BinaryPackageFile.binarypackagerelease
  AND BinaryPackageFile.libraryfile = LibraryFileAlias.id
  AND LibraryFileAlias.content = LibraryFileContent.id AND BinaryPackagePublishingHistory.status IN (2);
                                                                                                         QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 HashAggregate (cost=6614.28..6617.22 rows=294 width=94) (actual time=61.875..62.380 rows=596 loops=1)
   -> Nested Loop (cost=0.00..6610.60 rows=294 width=94) (actual time=0.094..58.355 rows=1642 loops=1)
         -> Nested Loop (cost=0.00..6055.27 rows=378 width=4) (actual time=0.076..43.243 rows=1642 loops=1)
               -> Nested Loop (cost=0.00..5274.09 rows=378 width=4) (actual time=0.057..27.212 rows=1642 loops=1)
                     -> Index Scan using securebinarypackagepublishinghistory__archive__status__idx on binarypackagepublishinghistory (cost=0.00..2735.80 rows=378 width=4) (actual time=0.036..13.610 rows=1642 loops=1)
                           Index Cond: ((archive = 14516) AND (status = 2))
                           Filter: (dateremoved IS NULL)
                     -> Index Scan using binarypackagefile_binarypackage_idx on binarypackagefile (cost=0.00..6.70 rows=1 width=8) (actual time=0.006..0.007 rows=1 loops=1642)
                           Index Cond: (binarypackagefile.binarypackagerelease = binarypackagepublishinghistory.binarypackagerelease)
               -> Index Scan using libraryfilealias_pkey on libraryfilealias (cost=0.00..2.05 rows=1 width=8) (actual time=0.008..0.008 rows=1 loops=1642)
                     Index Cond: (libraryfilealias.id = binarypackagefile.libraryfile)
         -> Index Scan using libraryfilecontent_pkey on libraryfilecontent (cost=0.00..1.46 rows=1 width=94) (actual time=0.007..0.007 rows=1 loops=1642)
               Index Cond: (libraryfilecontent.id = libraryfilealias.content)
 Total runtime: 62.705 ms