"Sort (cost=6340944.91..6340946.34 rows=571 width=176) (actual time=1039.723..1039.724 rows=0 loops=1)" " Output: (1), lookup.internalid, lookup.rownumber, lookup.publicid, (NULL::text), (NULL::text), (NULL::bytea), (NULL::integer), (NULL::integer), (NULL::integer), (NULL::bigint), (NULL::bigint)" " Sort Key: (1), lookup.rownumber" " Sort Method: quicksort Memory: 25kB" " Buffers: shared hit=57595 read=804" " CTE lookup" " -> WindowAgg (cost=5513.28..5513.30 rows=1 width=61) (actual time=1039.664..1039.664 rows=0 loops=1)" " Output: studies.publicid, studies.internalid, row_number() OVER (?)" " Buffers: shared hit=57592 read=804" " -> Sort (cost=5513.28..5513.29 rows=1 width=53) (actual time=1039.650..1039.650 rows=0 loops=1)" " Output: studies.publicid, studies.internalid" " Sort Key: studies.publicid" " Sort Method: quicksort Memory: 25kB" " Buffers: shared hit=57592 read=804" " -> Nested Loop (cost=5446.01..5513.27 rows=1 width=53) (actual time=1039.610..1039.610 rows=0 loops=1)" " Output: studies.publicid, studies.internalid" " Inner Unique: true" " Join Filter: (studies.internalid = t0.id)" " Buffers: shared hit=57586 read=804" " -> Nested Loop (cost=5445.45..5509.85 rows=1 width=69) (actual time=1039.609..1039.609 rows=0 loops=1)" " Output: studies.publicid, studies.internalid, t1.id, t2.id" " Inner Unique: true" " Buffers: shared hit=57586 read=804" " -> Nested Loop (cost=5445.01..5507.42 rows=1 width=16) (actual time=1039.608..1039.608 rows=0 loops=1)" " Output: t1.id, t2.id" " Inner Unique: true" " Buffers: shared hit=57586 read=804" " -> Bitmap Heap Scan on public.dicomidentifiers t2 (cost=5444.45..5464.48 rows=5 width=8) (actual time=1039.607..1039.607 rows=0 loops=1)" " Output: t2.id, t2.taggroup, t2.tagelement, t2.value" " Recheck Cond: ((t2.value ~~ '%16388861%'::text) AND (t2.taggroup = 16) AND (t2.tagelement = 32))" " Buffers: shared hit=57586 read=804" " -> BitmapAnd (cost=5444.45..5444.45 rows=5 width=0) (actual time=1039.600..1039.600 rows=0 loops=1)" " Buffers: shared hit=57586 read=804" " -> Bitmap Index Scan on dicomidentifiersindexvalues2 (cost=0.00..1148.74 rows=2765 width=0) (actual time=444.272..444.273 rows=7 loops=1)" " Index Cond: (t2.value ~~ '%16388861%'::text)" " Buffers: shared hit=1124 read=804" " -> Bitmap Index Scan on dicomidentifiersindex2 (cost=0.00..4295.46 rows=53490 width=0) (actual time=589.980..589.980 rows=855808 loops=1)" " Index Cond: ((t2.taggroup = 16) AND (t2.tagelement = 32))" " Buffers: shared hit=56462" " -> Index Scan using dicomidentifiers_pkey on public.dicomidentifiers t1 (cost=0.56..8.59 rows=1 width=8) (never executed)" " Output: t1.id, t1.taggroup, t1.tagelement, t1.value" " Index Cond: ((t1.id = t2.id) AND (t1.taggroup = 8) AND (t1.tagelement = 32))" " Filter: (t1.value <= '20260325'::text)" " -> Index Scan using resources_pkey on public.resources studies (cost=0.44..2.43 rows=1 width=53) (never executed)" " Output: studies.internalid, studies.resourcetype, studies.publicid, studies.parentid, studies.childcount" " Index Cond: (studies.internalid = t1.id)" " Filter: (studies.resourcetype = 1)" " -> Index Scan using dicomidentifiersindex1 on public.dicomidentifiers t0 (cost=0.56..3.41 rows=1 width=8) (never executed)" " Output: t0.id, t0.taggroup, t0.tagelement, t0.value" " Index Cond: (t0.id = t1.id)" " Filter: ((t0.value >= '20260325'::text) AND (t0.taggroup = 8) AND (t0.tagelement = 32))" " CTE validgrandchildcounts" " -> GroupAggregate (cost=1603059.89..5743975.70 rows=25562297 width=16) (never executed)" " Output: thislevel.internalid, COALESCE(sum(childlevel_1.childcount), '0'::bigint)" " Group Key: thislevel.internalid" " -> Merge Left Join (cost=1603059.89..5360541.25 rows=25562297 width=12) (never executed)" " Output: thislevel.internalid, childlevel_1.childcount" " Merge Cond: (thislevel.internalid = childlevel_1.parentid)" " -> Merge Anti Join (cost=1596987.33..2788094.27 rows=25562297 width=8) (never executed)" " Output: thislevel.internalid" " Merge Cond: (thislevel.internalid = invalidchildcounts.id)" " -> Merge Anti Join (cost=1596971.65..2447779.62 rows=25577143 width=8) (never executed)" " Output: thislevel.internalid" " Merge Cond: (thislevel.internalid = child.parentid)" " -> Index Only Scan using resources_pkey on public.resources thislevel (cost=0.44..719114.70 rows=25642417 width=8) (never executed)" " Output: thislevel.internalid" " Heap Fetches: 0" " -> Sort (cost=1596910.49..1608244.14 rows=4533461 width=8) (never executed)" " Output: child.parentid" " Sort Key: child.parentid" " -> Gather (cost=497016.59..1033705.43 rows=4533461 width=8) (never executed)" " Output: child.parentid" " Workers Planned: 4" " Workers Launched: 0" " -> Parallel Hash Join (cost=496016.59..579359.33 rows=1133365 width=8) (never executed)" " Output: child.parentid" " Inner Unique: true" " Hash Cond: (invalidchildcounts_1.id = child.internalid)" " -> Parallel Seq Scan on public.invalidchildcounts invalidchildcounts_1 (cost=0.00..40209.65 rows=1133365 width=8) (never executed)" " Output: invalidchildcounts_1.id" " -> Parallel Hash (cost=384582.04..384582.04 rows=6410604 width=16) (never executed)" " Output: child.internalid, child.parentid" " -> Parallel Seq Scan on public.resources child (cost=0.00..384582.04 rows=6410604 width=16) (never executed)" " Output: child.internalid, child.parentid" " -> Index Only Scan using invalidchildcountsid on public.invalidchildcounts (cost=0.43..219895.69 rows=4533461 width=8) (never executed)" " Output: invalidchildcounts.id" " Heap Fetches: 0" " -> Index Scan using childrenindex2 on public.resources childlevel_1 (cost=0.56..2202345.36 rows=25642417 width=12) (never executed)" " Output: childlevel_1.internalid, childlevel_1.resourcetype, childlevel_1.publicid, childlevel_1.parentid, childlevel_1.childcount" " -> Append (cost=0.00..591429.76 rows=571 width=176) (actual time=1039.680..1039.680 rows=0 loops=1)" " Buffers: shared hit=57592 read=804" " -> CTE Scan on lookup (cost=0.00..0.02 rows=1 width=290) (actual time=1039.668..1039.668 rows=0 loops=1)" " Output: 1, lookup.internalid, lookup.rownumber, lookup.publicid, NULL::text, NULL::text, NULL::bytea, NULL::integer, NULL::integer, NULL::integer, NULL::bigint, NULL::bigint" " Buffers: shared hit=57592 read=804" " -> Subquery Scan on "*SELECT* 2" (cost=0.57..962.42 rows=275 width=176) (actual time=0.002..0.002 rows=0 loops=1)" " Output: 2, "*SELECT* 2".c1_internalid, NULL::bigint, "*SELECT* 2".c3_string1, NULL::text, NULL::text, NULL::bytea, "*SELECT* 2".c7_int1, "*SELECT* 2".c8_int2, NULL::integer, NULL::bigint, NULL::bigint" " -> Nested Loop (cost=0.57..959.67 rows=275 width=165) (actual time=0.001..0.001 rows=0 loops=1)" " Output: 2, lookup_1.internalid, NULL::bigint, maindicomtags.value, NULL::text, NULL::text, NULL::bytea, maindicomtags.taggroup, maindicomtags.tagelement, NULL::integer, NULL::bigint, NULL::bigint" " -> CTE Scan on lookup lookup_1 (cost=0.00..0.02 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=1)" " Output: lookup_1.publicid, lookup_1.internalid, lookup_1.rownumber" " -> Index Scan using maindicomtagsindex on public.maindicomtags (cost=0.57..956.90 rows=275 width=37) (never executed)" " Output: maindicomtags.id, maindicomtags.taggroup, maindicomtags.tagelement, maindicomtags.value" " Index Cond: (maindicomtags.id = lookup_1.internalid)" " -> Subquery Scan on "*SELECT* 3" (cost=0.57..1037.04 rows=290 width=176) (actual time=0.002..0.002 rows=0 loops=1)" " Output: 4, "*SELECT* 3".c1_internalid, NULL::bigint, "*SELECT* 3".c3_string1, NULL::text, NULL::text, NULL::bytea, "*SELECT* 3".c7_int1, "*SELECT* 3".c8_int2, NULL::integer, NULL::bigint, NULL::bigint" " -> Nested Loop (cost=0.57..1034.14 rows=290 width=169) (actual time=0.001..0.001 rows=0 loops=1)" " Output: 4, lookup_2.internalid, NULL::bigint, metadata.value, NULL::text, NULL::text, NULL::bytea, metadata.type, metadata.revision, NULL::integer, NULL::bigint, NULL::bigint" " -> CTE Scan on lookup lookup_2 (cost=0.00..0.02 rows=1 width=8) (actual time=0.000..0.001 rows=0 loops=1)" " Output: lookup_2.publicid, lookup_2.internalid, lookup_2.rownumber" " -> Index Scan using metadata_pkey on public.metadata (cost=0.57..1031.22 rows=290 width=41) (never executed)" " Output: metadata.id, metadata.type, metadata.value, metadata.revision" " Index Cond: (metadata.id = lookup_2.internalid)" " -> Subquery Scan on "*SELECT* 4" (cost=1.13..446.01 rows=4 width=176) (actual time=0.002..0.002 rows=0 loops=1)" " Output: 21, "*SELECT* 4".c1_internalid, NULL::bigint, "*SELECT* 4".c3_string1, NULL::text, NULL::text, NULL::bytea, "*SELECT* 4".c7_int1, "*SELECT* 4".c8_int2, NULL::integer, NULL::bigint, NULL::bigint" " -> Nested Loop (cost=1.13..445.97 rows=4 width=165) (actual time=0.002..0.002 rows=0 loops=1)" " Output: 21, lookup_3.internalid, NULL::bigint, maindicomtags_1.value, NULL::text, NULL::text, NULL::bytea, maindicomtags_1.taggroup, maindicomtags_1.tagelement, NULL::integer, NULL::bigint, NULL::bigint" " Inner Unique: true" " -> Nested Loop (cost=0.56..38.64 rows=391 width=16) (actual time=0.001..0.001 rows=0 loops=1)" " Output: lookup_3.internalid, childlevel.internalid" " -> CTE Scan on lookup lookup_3 (cost=0.00..0.02 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=1)" " Output: lookup_3.publicid, lookup_3.internalid, lookup_3.rownumber" " -> Index Only Scan using childrenindex2 on public.resources childlevel (cost=0.56..34.71 rows=391 width=16) (never executed)" " Output: childlevel.parentid, childlevel.publicid, childlevel.internalid" " Index Cond: (childlevel.parentid = lookup_3.internalid)" " Heap Fetches: 0" " -> Index Scan using maindicomtags_pkey on public.maindicomtags maindicomtags_1 (cost=0.57..1.04 rows=1 width=37) (never executed)" " Output: maindicomtags_1.id, maindicomtags_1.taggroup, maindicomtags_1.tagelement, maindicomtags_1.value" " Index Cond: ((maindicomtags_1.id = childlevel.internalid) AND (maindicomtags_1.taggroup = 8) AND (maindicomtags_1.tagelement = 96))" " -> Subquery Scan on "*SELECT* 5" (cost=0.00..588981.41 rows=1 width=176) (actual time=0.002..0.002 rows=0 loops=1)" " Output: 33, "*SELECT* 5".c1_internalid, NULL::bigint, NULL::text, NULL::text, NULL::text, NULL::bytea, NULL::integer, NULL::integer, NULL::integer, "*SELECT* 5".c10_big_int1, NULL::bigint" " -> CTE Scan on lookup lookup_4 (cost=0.00..588981.40 rows=1 width=176) (actual time=0.001..0.001 rows=0 loops=1)" " Output: 33, lookup_4.internalid, NULL::bigint, NULL::text, NULL::text, NULL::text, NULL::bytea, NULL::integer, NULL::integer, NULL::integer, COALESCE((SubPlan 3), (SubPlan 4)), NULL::bigint" " SubPlan 3" " -> CTE Scan on validgrandchildcounts (cost=0.00..575151.68 rows=127811 width=8) (never executed)" " Output: validgrandchildcounts.totalgrandchildcount" " Filter: (validgrandchildcounts.internalid = lookup_4.internalid)" " SubPlan 4" " -> Aggregate (cost=13829.68..13829.69 rows=1 width=8) (never executed)" " Output: count(grandchildlevel.internalid)" " -> Nested Loop (cost=1.13..13828.71 rows=391 width=8) (never executed)" " Output: grandchildlevel.internalid" " -> Index Only Scan using childrenindex2 on public.resources childlevel_2 (cost=0.56..34.71 rows=391 width=8) (never executed)" " Output: childlevel_2.parentid, childlevel_2.publicid, childlevel_2.internalid" " Index Cond: (childlevel_2.parentid = lookup_4.internalid)" " Heap Fetches: 0" " -> Index Only Scan using childrenindex2 on public.resources grandchildlevel (cost=0.56..31.37 rows=391 width=16) (never executed)" " Output: grandchildlevel.parentid, grandchildlevel.publicid, grandchildlevel.internalid" " Index Cond: (grandchildlevel.parentid = childlevel_2.internalid)" " Heap Fetches: 0""Sort (cost=6335454.79..6335456.22 rows=571 width=176) (actual time=57835.479..57835.480 rows=36 loops=1)" " Output: (1), lookup.internalid, lookup.rownumber, lookup.publicid, (NULL::text), (NULL::text), (NULL::bytea), (NULL::integer), (NULL::integer), (NULL::integer), (NULL::bigint), (NULL::bigint)" " Sort Key: (1), lookup.rownumber" " Sort Method: quicksort Memory: 28kB" " Buffers: shared hit=11521581, temp read=192079 written=193084" " CTE lookup" " -> WindowAgg (cost=23.16..23.18 rows=1 width=61) (actual time=0.212..0.215 rows=2 loops=1)" " Output: studies.publicid, studies.internalid, row_number() OVER (?)" " Buffers: shared hit=54" " -> Sort (cost=23.16..23.17 rows=1 width=53) (actual time=0.202..0.203 rows=2 loops=1)" " Output: studies.publicid, studies.internalid" " Sort Key: studies.publicid" " Sort Method: quicksort Memory: 25kB" " Buffers: shared hit=54" " -> Nested Loop (cost=2.25..23.15 rows=1 width=53) (actual time=0.116..0.187 rows=2 loops=1)" " Output: studies.publicid, studies.internalid" " Inner Unique: true" " Join Filter: (studies.internalid = t0.id)" " Buffers: shared hit=54" " -> Nested Loop (cost=1.69..19.73 rows=1 width=69) (actual time=0.094..0.145 rows=3 loops=1)" " Output: studies.publicid, studies.internalid, t1.id, t2.id" " Inner Unique: true" " Buffers: shared hit=39" " -> Nested Loop (cost=1.25..17.30 rows=1 width=16) (actual time=0.081..0.111 rows=3 loops=1)" " Output: t1.id, t2.id" " Inner Unique: true" " Buffers: shared hit=27" " -> Index Scan using dicomidentifiersindex3 on public.dicomidentifiers t2 (cost=0.69..8.71 rows=1 width=8) (actual time=0.051..0.059 rows=4 loops=1)" " Output: t2.id, t2.taggroup, t2.tagelement, t2.value" " Index Cond: ((t2.taggroup = 16) AND (t2.tagelement = 32) AND (t2.value = '1353085'::text))" " Buffers: shared hit=8" " -> Index Scan using dicomidentifiers_pkey on public.dicomidentifiers t1 (cost=0.56..8.59 rows=1 width=8) (actual time=0.011..0.011 rows=1 loops=4)" " Output: t1.id, t1.taggroup, t1.tagelement, t1.value" " Index Cond: ((t1.id = t2.id) AND (t1.taggroup = 8) AND (t1.tagelement = 32))" " Filter: (t1.value <= '20260325'::text)" " Buffers: shared hit=19" " -> Index Scan using resources_pkey on public.resources studies (cost=0.44..2.43 rows=1 width=53) (actual time=0.011..0.011 rows=1 loops=3)" " Output: studies.internalid, studies.resourcetype, studies.publicid, studies.parentid, studies.childcount" " Index Cond: (studies.internalid = t1.id)" " Filter: (studies.resourcetype = 1)" " Buffers: shared hit=12" " -> Index Scan using dicomidentifiersindex1 on public.dicomidentifiers t0 (cost=0.56..3.41 rows=1 width=8) (actual time=0.013..0.013 rows=1 loops=3)" " Output: t0.id, t0.taggroup, t0.tagelement, t0.value" " Index Cond: (t0.id = t1.id)" " Filter: ((t0.value >= '20260325'::text) AND (t0.taggroup = 8) AND (t0.tagelement = 32))" " Rows Removed by Filter: 2" " Buffers: shared hit=15" " CTE validgrandchildcounts" " -> GroupAggregate (cost=1603059.89..5743975.70 rows=25562297 width=16) (actual time=4889.780..45440.525 rows=25454382 loops=1)" " Output: thislevel.internalid, COALESCE(sum(childlevel_1.childcount), '0'::bigint)" " Group Key: thislevel.internalid" " Buffers: shared hit=11521484, temp read=111291 written=112296" " -> Merge Left Join (cost=1603059.89..5360541.25 rows=25562297 width=12) (actual time=4889.761..35101.282 rows=49580832 loops=1)" " Output: thislevel.internalid, childlevel_1.childcount" " Merge Cond: (thislevel.internalid = childlevel_1.parentid)" " Buffers: shared hit=11521484, temp read=111291 written=112296" " -> Merge Anti Join (cost=1596987.33..2788094.27 rows=25562297 width=8) (actual time=4889.697..12487.036 rows=25454382 loops=1)" " Output: thislevel.internalid" " Merge Cond: (thislevel.internalid = invalidchildcounts.id)" " Buffers: shared hit=4091440, temp read=111291 written=112296" " -> Merge Anti Join (cost=1596971.65..2447779.62 rows=25577143 width=8) (actual time=4829.615..10711.648 rows=25454382 loops=1)" " Output: thislevel.internalid" " Merge Cond: (thislevel.internalid = child.parentid)" " Buffers: shared hit=4079051, temp read=111291 written=112296" " -> Index Only Scan using resources_pkey on public.resources thislevel (cost=0.44..719114.70 rows=25642417 width=8) (actual time=0.028..4111.078 rows=25454382 loops=1)" " Output: thislevel.internalid" " Heap Fetches: 3153729" " Buffers: shared hit=3729431" " -> Sort (cost=1596910.49..1608244.14 rows=4533461 width=8) (actual time=4829.583..4829.583 rows=0 loops=1)" " Output: child.parentid" " Sort Key: child.parentid" " Sort Method: quicksort Memory: 25kB" " Buffers: shared hit=349620, temp read=111291 written=112296" " -> Gather (cost=497016.59..1033705.43 rows=4533461 width=8) (actual time=4829.571..5535.453 rows=0 loops=1)" " Output: child.parentid" " Workers Planned: 4" " Workers Launched: 4" " Buffers: shared hit=349620, temp read=111291 written=112296" " -> Parallel Hash Join (cost=496016.59..579359.33 rows=1133365 width=8) (actual time=4757.363..4757.460 rows=0 loops=5)" " Output: child.parentid" " Inner Unique: true" " Hash Cond: (invalidchildcounts_1.id = child.internalid)" " Buffers: shared hit=349620, temp read=111291 written=112296" " Worker 0: actual time=4746.748..4746.759 rows=0 loops=1" " Buffers: shared hit=65507, temp read=22685 written=21180" " Worker 1: actual time=4749.028..4749.041 rows=0 loops=1" " Buffers: shared hit=65438, temp read=21752 written=21104" " Worker 2: actual time=4738.559..4738.568 rows=0 loops=1" " Buffers: shared hit=66332, temp read=22641 written=21384" " Worker 3: actual time=4744.270..4744.280 rows=0 loops=1" " Buffers: shared hit=64243, temp read=22294 written=20700" " -> Parallel Seq Scan on public.invalidchildcounts invalidchildcounts_1 (cost=0.00..40209.65 rows=1133365 width=8) (actual time=65.402..65.402 rows=0 loops=5)" " Output: invalidchildcounts_1.id" " Buffers: shared hit=28876" " Worker 0: actual time=65.400..65.401 rows=0 loops=1" " Buffers: shared hit=5075" " Worker 1: actual time=65.393..65.393 rows=0 loops=1" " Buffers: shared hit=5140" " Worker 2: actual time=65.408..65.408 rows=0 loops=1" " Buffers: shared hit=5114" " Worker 3: actual time=65.404..65.404 rows=0 loops=1" " Buffers: shared hit=5267" " -> Parallel Hash (cost=384582.04..384582.04 rows=6410604 width=16) (actual time=3345.708..3345.708 rows=5090876 loops=5)" " Output: child.internalid, child.parentid" " Buckets: 524288 Batches: 128 Memory Usage: 13536kB" " Buffers: shared hit=320476, temp written=112296" " Worker 0: actual time=3336.487..3336.487 rows=4792128 loops=1" " Buffers: shared hit=60365, temp written=21180" " Worker 1: actual time=3338.923..3338.923 rows=4780155 loops=1" " Buffers: shared hit=60231, temp written=21104" " Worker 2: actual time=3328.487..3328.488 rows=4859090 loops=1" " Buffers: shared hit=61151, temp written=21384" " Worker 3: actual time=3334.139..3334.139 rows=4679966 loops=1" " Buffers: shared hit=58909, temp written=20700" " -> Parallel Seq Scan on public.resources child (cost=0.00..384582.04 rows=6410604 width=16) (actual time=0.036..2016.367 rows=5090876 loops=5)" " Output: child.internalid, child.parentid" " Buffers: shared hit=320476" " Worker 0: actual time=0.031..2036.486 rows=4792128 loops=1" " Buffers: shared hit=60365" " Worker 1: actual time=0.032..2056.807 rows=4780155 loops=1" " Buffers: shared hit=60231" " Worker 2: actual time=0.040..2037.733 rows=4859090 loops=1" " Buffers: shared hit=61151" " Worker 3: actual time=0.052..2026.906 rows=4679966 loops=1" " Buffers: shared hit=58909" " -> Index Only Scan using invalidchildcountsid on public.invalidchildcounts (cost=0.43..219895.69 rows=4533461 width=8) (actual time=60.072..60.072 rows=0 loops=1)" " Output: invalidchildcounts.id" " Heap Fetches: 0" " Buffers: shared hit=12389" " -> Index Scan using childrenindex2 on public.resources childlevel_1 (cost=0.56..2202345.36 rows=25642417 width=12) (actual time=0.055..14205.414 rows=25320153 loops=1)" " Output: childlevel_1.internalid, childlevel_1.resourcetype, childlevel_1.publicid, childlevel_1.parentid, childlevel_1.childcount" " Buffers: shared hit=7430044" " -> Append (cost=0.00..591429.76 rows=571 width=176) (actual time=0.216..57835.451 rows=36 loops=1)" " Buffers: shared hit=11521581, temp read=192079 written=193084" " -> CTE Scan on lookup (cost=0.00..0.02 rows=1 width=290) (actual time=0.216..0.219 rows=2 loops=1)" " Output: 1, lookup.internalid, lookup.rownumber, lookup.publicid, NULL::text, NULL::text, NULL::bytea, NULL::integer, NULL::integer, NULL::integer, NULL::bigint, NULL::bigint" " Buffers: shared hit=54" " -> Subquery Scan on "*SELECT* 2" (cost=0.57..962.42 rows=275 width=176) (actual time=0.019..0.044 rows=26 loops=1)" " Output: 2, "*SELECT* 2".c1_internalid, NULL::bigint, "*SELECT* 2".c3_string1, NULL::text, NULL::text, NULL::bytea, "*SELECT* 2".c7_int1, "*SELECT* 2".c8_int2, NULL::integer, NULL::bigint, NULL::bigint" " Buffers: shared hit=11" " -> Nested Loop (cost=0.57..959.67 rows=275 width=165) (actual time=0.018..0.039 rows=26 loops=1)" " Output: 2, lookup_1.internalid, NULL::bigint, maindicomtags.value, NULL::text, NULL::text, NULL::bytea, maindicomtags.taggroup, maindicomtags.tagelement, NULL::integer, NULL::bigint, NULL::bigint" " Buffers: shared hit=11" " -> CTE Scan on lookup lookup_1 (cost=0.00..0.02 rows=1 width=8) (actual time=0.000..0.002 rows=2 loops=1)" " Output: lookup_1.publicid, lookup_1.internalid, lookup_1.rownumber" " -> Index Scan using maindicomtagsindex on public.maindicomtags (cost=0.57..956.90 rows=275 width=37) (actual time=0.011..0.015 rows=13 loops=2)" " Output: maindicomtags.id, maindicomtags.taggroup, maindicomtags.tagelement, maindicomtags.value" " Index Cond: (maindicomtags.id = lookup_1.internalid)" " Buffers: shared hit=11" " -> Subquery Scan on "*SELECT* 3" (cost=0.57..1037.04 rows=290 width=176) (actual time=0.025..0.037 rows=4 loops=1)" " Output: 4, "*SELECT* 3".c1_internalid, NULL::bigint, "*SELECT* 3".c3_string1, NULL::text, NULL::text, NULL::bytea, "*SELECT* 3".c7_int1, "*SELECT* 3".c8_int2, NULL::integer, NULL::bigint, NULL::bigint" " Buffers: shared hit=11" " -> Nested Loop (cost=0.57..1034.14 rows=290 width=169) (actual time=0.025..0.035 rows=4 loops=1)" " Output: 4, lookup_2.internalid, NULL::bigint, metadata.value, NULL::text, NULL::text, NULL::bytea, metadata.type, metadata.revision, NULL::integer, NULL::bigint, NULL::bigint" " Buffers: shared hit=11" " -> CTE Scan on lookup lookup_2 (cost=0.00..0.02 rows=1 width=8) (actual time=0.000..0.000 rows=2 loops=1)" " Output: lookup_2.publicid, lookup_2.internalid, lookup_2.rownumber" " -> Index Scan using metadata_pkey on public.metadata (cost=0.57..1031.22 rows=290 width=41) (actual time=0.015..0.016 rows=2 loops=2)" " Output: metadata.id, metadata.type, metadata.value, metadata.revision" " Index Cond: (metadata.id = lookup_2.internalid)" " Buffers: shared hit=11" " -> Subquery Scan on "*SELECT* 4" (cost=1.13..446.01 rows=4 width=176) (actual time=0.044..0.055 rows=2 loops=1)" " Output: 21, "*SELECT* 4".c1_internalid, NULL::bigint, "*SELECT* 4".c3_string1, NULL::text, NULL::text, NULL::bytea, "*SELECT* 4".c7_int1, "*SELECT* 4".c8_int2, NULL::integer, NULL::bigint, NULL::bigint" " Buffers: shared hit=21" " -> Nested Loop (cost=1.13..445.97 rows=4 width=165) (actual time=0.043..0.054 rows=2 loops=1)" " Output: 21, lookup_3.internalid, NULL::bigint, maindicomtags_1.value, NULL::text, NULL::text, NULL::bytea, maindicomtags_1.taggroup, maindicomtags_1.tagelement, NULL::integer, NULL::bigint, NULL::bigint" " Inner Unique: true" " Buffers: shared hit=21" " -> Nested Loop (cost=0.56..38.64 rows=391 width=16) (actual time=0.019..0.025 rows=2 loops=1)" " Output: lookup_3.internalid, childlevel.internalid" " Buffers: shared hit=11" " -> CTE Scan on lookup lookup_3 (cost=0.00..0.02 rows=1 width=8) (actual time=0.000..0.001 rows=2 loops=1)" " Output: lookup_3.publicid, lookup_3.internalid, lookup_3.rownumber" " -> Index Only Scan using childrenindex2 on public.resources childlevel (cost=0.56..34.71 rows=391 width=16) (actual time=0.011..0.012 rows=1 loops=2)" " Output: childlevel.parentid, childlevel.publicid, childlevel.internalid" " Index Cond: (childlevel.parentid = lookup_3.internalid)" " Heap Fetches: 2" " Buffers: shared hit=11" " -> Index Scan using maindicomtags_pkey on public.maindicomtags maindicomtags_1 (cost=0.57..1.04 rows=1 width=37) (actual time=0.014..0.014 rows=1 loops=2)" " Output: maindicomtags_1.id, maindicomtags_1.taggroup, maindicomtags_1.tagelement, maindicomtags_1.value" " Index Cond: ((maindicomtags_1.id = childlevel.internalid) AND (maindicomtags_1.taggroup = 8) AND (maindicomtags_1.tagelement = 96))" " Buffers: shared hit=10" " -> Subquery Scan on "*SELECT* 5" (cost=0.00..588981.41 rows=1 width=176) (actual time=54678.968..57835.089 rows=2 loops=1)" " Output: 33, "*SELECT* 5".c1_internalid, NULL::bigint, NULL::text, NULL::text, NULL::text, NULL::bytea, NULL::integer, NULL::integer, NULL::integer, "*SELECT* 5".c10_big_int1, NULL::bigint" " Buffers: shared hit=11521484, temp read=192079 written=193084" " -> CTE Scan on lookup lookup_4 (cost=0.00..588981.40 rows=1 width=176) (actual time=54678.966..57835.085 rows=2 loops=1)" " Output: 33, lookup_4.internalid, NULL::bigint, NULL::text, NULL::text, NULL::text, NULL::bytea, NULL::integer, NULL::integer, NULL::integer, COALESCE((SubPlan 3), (SubPlan 4)), NULL::bigint" " Buffers: shared hit=11521484, temp read=192079 written=193084" " SubPlan 3" " -> CTE Scan on validgrandchildcounts (cost=0.00..575151.68 rows=127811 width=8) (actual time=28907.599..28917.533 rows=1 loops=2)" " Output: validgrandchildcounts.totalgrandchildcount" " Filter: (validgrandchildcounts.internalid = lookup_4.internalid)" " Rows Removed by Filter: 25454381" " Buffers: shared hit=11521484, temp read=192079 written=193084" " SubPlan 4" " -> Aggregate (cost=13829.68..13829.69 rows=1 width=8) (never executed)" " Output: count(grandchildlevel.internalid)" " -> Nested Loop (cost=1.13..13828.71 rows=391 width=8) (never executed)" " Output: grandchildlevel.internalid" " -> Index Only Scan using childrenindex2 on public.resources childlevel_2 (cost=0.56..34.71 rows=391 width=8) (never executed)" " Output: childlevel_2.parentid, childlevel_2.publicid, childlevel_2.internalid" " Index Cond: (childlevel_2.parentid = lookup_4.internalid)" " Heap Fetches: 0" " -> Index Only Scan using childrenindex2 on public.resources grandchildlevel (cost=0.56..31.37 rows=391 width=16) (never executed)" " Output: grandchildlevel.parentid, grandchildlevel.publicid, grandchildlevel.internalid" " Index Cond: (grandchildlevel.parentid = childlevel_2.internalid)" " Heap Fetches: 0" "Planning Time: 318.177 ms" "Execution Time: 58727.542 ms"