Can someone verify that this is a sound change?  rhn-satellite-exporter is 
extremely slow on PostgreSQL when getting the file checksums.  This speeds it 
up dramatically.

It's the same issue we ran into with PostgreSQL doing a left join on 
rhnChecksumView in 'query_client_get_file'.  PostgreSQL does a sequence scan on 
a table with millions of rows.  I patched it in 
1e64dc4546d96c58dd84a88c3c634b2d2ce164a4 but Michael had to fix it in 
79e57d3b215340a54e911a073408f0eb7c6afc1f.  I just want to be sure my SQL is 
proper on this one before committing this time.

diff --git a/backend/satellite_tools/exporter/exportLib.py b/backend/satellite_t
index 1646c58..1f265a2 100644
--- a/backend/satellite_tools/exporter/exportLib.py
+++ b/backend/satellite_tools/exporter/exportLib.py
@@ -753,7 +753,12 @@ class _PackageDumper(BaseRowDumper):
                 c.checksum_type as "checksum-type",
                 c.checksum, pf.linkto, pf.flags, pf.verifyflags, pf.lang
             from rhnPackageFile pf
-            left join rhnChecksumView c
+            left join
+              (select c.*
+               from rhnPackageFile pf
+                 inner join rhnChecksumView c
+                   on pf.checksum_id = c.id
+               where pf.package_id = :package_id) c
               on pf.checksum_id = c.id,
                 rhnPackageCapability pc
             where pf.capability_id = pc.id

/aron

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to