(thats with disk IO, its 8-8.5seconds when repeated. plan for it: QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=1261.93..1261.94 rows=1 width=0) (actual time=8106.454..8106.455 rows=1 loops=1) -> Unique (cost=1261.85..1261.90 rows=2 width=830) (actual time=7895.168..8106.442 rows=1 loops=1) -> Sort (cost=1261.85..1261.85 rows=2 width=830) (actual time=7895.165..7903.721 rows=1382 loops=1) Sort Key: distributionsourcepackagecache.archive, distributionsourcepackagecache.binpkgdescriptions, distributionsourcepackagecache.binpkgnames, distributionsourcepackagecache.binpkgsummaries, distributionsourcepackagecache.changelog, distributionsourcepackagecache.distribution, distributionsourcepackagecache.id, distributionsourcepackagecache.name, distributionsourcepackagecache.sourcepackagename Sort Method: quicksort Memory: 761kB -> Nested Loop (cost=0.00..1261.84 rows=2 width=830) (actual time=1.103..7686.693 rows=1382 loops=1) -> Nested Loop (cost=0.00..649.04 rows=1 width=8) (actual time=0.195..364.537 rows=1917 loops=1) -> Nested Loop (cost=0.00..648.76 rows=1 width=4) (actual time=0.180..335.799 rows=1917 loops=1) -> Nested Loop (cost=0.00..648.21 rows=1 width=4) (actual time=0.161..299.414 rows=1917 loops=1) Join Filter: (distroarchseries.distroseries = distroseries.id) -> Seq Scan on distroseries (cost=0.00..2.45 rows=1 width=4) (actual time=0.031..0.077 rows=6 loops=1) Filter: ((releasestatus <> 6) AND (distribution = 1)) -> Nested Loop (cost=0.00..645.32 rows=35 width=8) (actual time=0.058..47.401 rows=2327 loops=6) -> Nested Loop (cost=0.00..635.52 rows=35 width=8) (actual time=0.052..33.313 rows=2327 loops=6) -> Nested Loop (cost=0.00..620.13 rows=35 width=4) (actual time=0.041..12.791 rows=2327 loops=6) -> Index Scan using binarypackagename_name_key on binarypackagename (cost=0.00..6.29 rows=1 width=4) (actual time=0.016..0.017 rows=1 loops=6) Index Cond: (name = 'mplayer'::text) -> Index Scan using binarypackagerelease_binarypackagename_key on binarypackagerelease (cost=0.00..610.97 rows=230 width=8) (actual time=0.021..8.937 rows=2327 loops=6) Index Cond: (binarypackagerelease.binarypackagename = binarypackagename.id) -> Index Scan using binarypackagebuild_pkey on binarypackagebuild (cost=0.00..0.43 rows=1 width=12) (actual time=0.005..0.006 rows=1 loops=13962) Index Cond: (binarypackagebuild.id = binarypackagerelease.build) -> Index Scan using distroarchrelease_pkey on distroarchseries (cost=0.00..0.27 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=13962) Index Cond: (distroarchseries.id = binarypackagebuild.distro_arch_series) -> Index Scan using sourcepackagerelease_pkey on sourcepackagerelease (cost=0.00..0.53 rows=1 width=8) (actual time=0.011..0.013 rows=1 loops=1917) Index Cond: (sourcepackagerelease.id = binarypackagebuild.source_package_release) -> Index Scan using sourcepackagename_pkey on sourcepackagename (cost=0.00..0.27 rows=1 width=4) (actual time=0.007..0.010 rows=1 loops=1917) Index Cond: (sourcepackagename.id = sourcepackagerelease.sourcepackagename) -> Index Scan using distributionsourcepackagecache__distribution__sourcepackagename on distributionsourcepackagecache (cost=0.00..612.79 rows=1 width=830) (actual time=1.340..3.815 rows=1 loops=1917) Index Cond: (distributionsourcepackagecache.sourcepackagename = sourcepackagerelease.sourcepackagename) Filter: (distributionsourcepackagecache.archive = ANY ('{1,534}'::integer[])) Total runtime: 8106.731 ms