Task #2998 (new)
Opened 14 years ago
Last modified 14 years ago
IMetadata.count & load SpecifiedAnnotations is quite slow with 8 million annotations
Reported by: | jamoore | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | Unscheduled |
Component: | Performance | Version: | n.a. |
Keywords: | n.a. | Cc: | jburel |
Resources: | n.a. | Referenced By: | n.a. |
References: | n.a. | Remaining Time: | n.a. |
Sprint: | n.a. |
Description
See logs below
Change History (4)
comment:1 Changed 14 years ago by jmoore
comment:2 Changed 14 years ago by jmoore
/tmp $ psql OMERO4.2__0 < ann.sql QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Nested Loop Left Join (cost=240386.32..240412.37 rows=1 width=8) (actual time=10419.807..10419.807 rows=0 loops=1) -> Nested Loop Left Join (cost=240386.32..240404.07 rows=1 width=16) (actual time=10419.805..10419.805 rows=0 loops=1) Join Filter: (annotation0_.owner_id = experiment2_.id) -> Nested Loop (cost=240386.32..240395.79 rows=1 width=24) (actual time=10419.805..10419.805 rows=0 loops=1) -> HashAggregate (cost=240386.32..240386.33 rows=1 width=8) (actual time=10419.804..10419.804 rows=0 loops=1) -> Seq Scan on annotation fileannota3_ (cost=0.00..240386.32 rows=1 width=8) (actual time=10419.801..10419.801 rows=0 loops=1) Filter: ((group_id = 1) AND ((discriminator)::text = '/type/OriginalFile/'::text)) -> Index Scan using annotation_pkey on annotation annotation0_ (cost=0.00..9.45 rows=1 width=24) (never executed) Index Cond: (annotation0_.id = fileannota3_.id) Filter: ((annotation0_.ns IS NOT NULL) AND (annotation0_.group_id = 1) AND (annotation0_.owner_id = 23053) AND ((annotation0_.ns)::text = 'openmicroscopy.org/omero/editor/protocol'::text)) -> Index Scan using experimenter_pkey on experimenter experiment2_ (cost=0.00..8.27 rows=1 width=8) (never executed) Index Cond: (experiment2_.id = 23053) -> Index Scan using event_pkey on event event1_ (cost=0.00..8.29 rows=1 width=8) (never executed) Index Cond: (annotation0_.creation_id = event1_.id) Total runtime: 10420.036 ms (15 rows)
/tmp $ cat ann.sql explain analyze select annotation0_.id from annotation annotation0_ left outer join event event1_ on annotation0_.creation_id=event1_.id left outer join experimenter experiment2_ on annotation0_.owner_id=experiment2_.id where ( annotation0_.group_id = 1 and (annotation0_.id in (select fileannota3_.id from annotation fileannota3_ where ( fileannota3_.group_id = 1 and fileannota3_.discriminator='/type/OriginalFile/')) and annotation0_.owner_id=23053 and (annotation0_.ns is not null) and (annotation0_.ns in ('openmicroscopy.org/omero/editor/protocol'))));
comment:3 Changed 14 years ago by jmoore
OMERO4.2__0=# select count(*) from annotation; count --------- 8477102 (1 row)
comment:4 Changed 14 years ago by jmoore
OMERO4.2__0=# explain analyze select count(*) from annotation; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=219193.27..219193.28 rows=1 width=0) (actual time=13040.930..13040.930 rows=1 loops=1) -> Seq Scan on annotation (cost=0.00..198000.21 rows=8477221 width=0) (actual time=0.040..12299.122 rows=8477102 loops=1) Total runtime: 13040.997 ms (3 rows) OMERO4.2__0=# explain analyze select count(*) from annotation; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=219193.27..219193.28 rows=1 width=0) (actual time=5433.525..5433.525 rows=1 loops=1) -> Seq Scan on annotation (cost=0.00..198000.21 rows=8477221 width=0) (actual time=0.031..4735.412 rows=8477102 loops=1) Total runtime: 5433.777 ms (3 rows) OMERO4.2__0=# explain analyze select count(*) from annotation; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=219193.27..219193.28 rows=1 width=0) (actual time=2139.698..2139.698 rows=1 loops=1) -> Seq Scan on annotation (cost=0.00..198000.21 rows=8477221 width=0) (actual time=0.045..1450.908 rows=8477102 loops=1) Total runtime: 2139.770 ms (3 rows) OMERO4.2__0=# vacuum annotation; VACUUM OMERO4.2__0=# explain analyze select count(*) from annotation; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=219191.78..219191.79 rows=1 width=0) (actual time=4518.881..4518.881 rows=1 loops=1) -> Seq Scan on annotation (cost=0.00..197999.02 rows=8477102 width=0) (actual time=0.018..3840.226 rows=8477102 loops=1) Total runtime: 4518.930 ms (3 rows) OMERO4.2__0=# explain analyze select count(*) from annotation; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=219191.78..219191.79 rows=1 width=0) (actual time=1904.879..1904.879 rows=1 loops=1) -> Seq Scan on annotation (cost=0.00..197999.02 rows=8477102 width=0) (actual time=0.031..1260.611 rows=8477102 loops=1) Total runtime: 1904.939 ms (3 rows) OMERO4.2__0=# vacuum analyze annotation; VACUUM OMERO4.2__0=# explain analyze select count(*) from annotation; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=219217.34..219217.35 rows=1 width=0) (actual time=1769.329..1769.330 rows=1 loops=1) -> Seq Scan on annotation (cost=0.00..198019.47 rows=8479147 width=0) (actual time=0.025..1161.017 rows=8477102 loops=1) Total runtime: 1769.395 ms (3 rows) OMERO4.2__0=# explain analyze select count(*) from annotation; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=219217.34..219217.35 rows=1 width=0) (actual time=1771.802..1771.802 rows=1 loops=1) -> Seq Scan on annotation (cost=0.00..198019.47 rows=8479147 width=0) (actual time=0.028..1162.214 rows=8477102 loops=1) Total runtime: 1771.855 ms (3 rows) OMERO4.2__0=# vacuum full annotation; VACUUM OMERO4.2__0=# explain analyze select count(*) from annotation; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=219012.78..219012.79 rows=1 width=0) (actual time=2029.477..2029.477 rows=1 loops=1) -> Seq Scan on annotation (cost=0.00..197820.02 rows=8477102 width=0) (actual time=0.013..1346.337 rows=8477102 loops=1) Total runtime: 2029.525 ms (3 rows) OMERO4.2__0=# explain analyze select count(*) from annotation; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=219012.78..219012.79 rows=1 width=0) (actual time=1980.364..1980.364 rows=1 loops=1) -> Seq Scan on annotation (cost=0.00..197820.02 rows=8477102 width=0) (actual time=0.021..1308.429 rows=8477102 loops=1) Total runtime: 1980.414 ms (3 rows) OMERO4.2__0=# vacuum full freeze verbose analyze annotation; INFO: vacuuming "public.annotation" INFO: "annotation": found 0 removable, 8477102 nonremovable row versions in 113049 pages DETAIL: 0 dead row versions cannot be removed yet. Nonremovable row versions range from 96 to 1880 bytes long. There were 1928 unused item pointers. Total free space (including removable row versions) is 7691216 bytes. 0 pages are or will become empty, including 0 at the end of the table. 11 pages containing 8144 free bytes are potential move destinations. CPU 8.52s/6.01u sec elapsed 92.26 sec. INFO: index "annotation_pkey" now contains 8477102 row versions in 29467 pages DETAIL: 0 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.21s/0.43u sec elapsed 5.25 sec. INFO: index "annotation_external_id_key" now contains 8477102 row versions in 29497 pages DETAIL: 0 index row versions were removed. 48 index pages have been deleted, 48 are currently reusable. CPU 0.21s/0.50u sec elapsed 8.23 sec. INFO: index "annotation_file" now contains 8477102 row versions in 23292 pages DETAIL: 0 index row versions were removed. 33 index pages have been deleted, 33 are currently reusable. CPU 0.17s/0.51u sec elapsed 6.94 sec. INFO: "annotation": moved 0 row versions, truncated 113049 to 113049 pages DETAIL: CPU 0.00s/0.00u sec elapsed 0.05 sec. INFO: vacuuming "pg_toast.pg_toast_1346912" INFO: "pg_toast_1346912": found 0 removable, 0 nonremovable row versions in 0 pages DETAIL: 0 dead row versions cannot be removed yet. Nonremovable row versions range from 0 to 0 bytes long. There were 0 unused item pointers. Total free space (including removable row versions) is 0 bytes. 0 pages are or will become empty, including 0 at the end of the table. 0 pages containing 0 free bytes are potential move destinations. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: index "pg_toast_1346912_index" now contains 0 row versions in 1 pages DETAIL: 0 index pages have been deleted, 0 are currently reusable. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: analyzing "public.annotation" INFO: "annotation": scanned 30000 of 113049 pages, containing 2249526 live rows and 0 dead rows; 30000 rows in sample, 8476889 estimated total rows VACUUM OMERO4.2__0=# explain analyze select count(*) from annotation; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Aggregate (cost=219010.12..219010.13 rows=1 width=0) (actual time=2334.848..2334.848 rows=1 loops=1) -> Seq Scan on annotation (cost=0.00..197817.89 rows=8476889 width=0) (actual time=0.013..1569.404 rows=8477102 loops=1) Total runtime: 2334.894 ms (3 rows)
Note: See
TracTickets for help on using
tickets.
You may also have a look at Agilo extensions to the ticket.