Forum OpenACS Development: Re: Slow Query in Logger

Collapse
7: Re: Slow Query in Logger (response to 1)
Posted by Alex Kroman on
Something is happening to screw up the query optimizer.

when I do:

set enable_seqscan to off;

and rerun it I get:

Sort (cost=152847.41..152847.58 rows=69 width=23) (actual time=1873.434..1873.449 rows=46 loops=1)
Sort Key: submitter.first_names, submitter.last_name
-> HashAggregate (cost=152844.96..152845.30 rows=69 width=23) (actual time=1872.942..1873.205 rows=46 loops=1)
-> Hash Join (cost=3.98..152724.60 rows=16048 width=23) (actual time=1.770..1760.872 rows=32715 loops=1)
Hash Cond: ("outer".creation_user = "inner".person_id)
-> Nested Loop (cost=0.00..152477.84 rows=16459 width=4) (actual time=0.684..1612.689 rows=32715 loops=1)
-> Index Scan using logger_entries_pk on logger_entries le (cost=0.00..95328.26 rows=16459 width=4) (actual time=0.443..786.734 rows=32715 loops=1)
Filter: (subplan)
SubPlan
-> Index Scan using logger_project_pkg_map_un on logger_project_pkg_map (cost=0.00..5.74 rows=2 width=0) (actual time=0.015..0.015 rows=1 loops=32715)
Index Cond: ((project_id = $0) AND (package_id = 784))
-> Index Scan using acs_objects_pk on acs_objects ao (cost=0.00..3.46 rows=1 width=8) (actual time=0.018..0.020 rows=1 loops=32715)
Index Cond: (ao.object_id = "outer".entry_id)
-> Hash (cost=3.81..3.81 rows=69 width=23) (actual time=0.996..0.996 rows=0 loops=1)
-> Index Scan using persons_pk on persons submitter (cost=0.00..3.81 rows=69 width=23) (actual time=0.321..0.738 rows=69 loops=1)
Total runtime: 1874.322 ms
(16 rows)

Any ideas?