Bugfest > 2021-02-09T00:32:51.927-05:00 09 Feb 2021 05:32:51:926 WARN PostgresClient [] EXPLAIN ANALYZE WITH headrecords AS ( SELECT jsonb, (lower(f_unaccent(jsonb->>'title')) ) AS data_column FROM fs09000000_mod_inventory_storage.instance WHERE (get_tsvector(f_unaccent(instance.jsonb->>'contributors')) @@ tsquery_phrase(f_unaccent('Bach, Johann Sebastian')) AND id in (select t.id from (select id as id, jsonb_array_elements(instance.jsonb->'contributors') as c ) as t where (get_tsvector(f_unaccent(t.c->>'name')) @@ tsquery_phrase(f_unaccent('Bach, Johann Sebastian'))))) AND left(lower(f_unaccent(jsonb->>'title')) ,600) < ( SELECT left(lower(f_unaccent(jsonb->>'title')) ,600) FROM fs09000000_mod_inventory_storage.instance ORDER BY left(lower(f_unaccent(jsonb->>'title')) ,600) OFFSET 10000 LIMIT 1 ) ORDER BY left(lower(f_unaccent(jsonb->>'title')) ,600) LIMIT 100 OFFSET 0 ), allrecords AS ( SELECT jsonb, lower(f_unaccent(jsonb->>'title')) AS data_column FROM fs09000000_mod_inventory_storage.instance WHERE (get_tsvector(f_unaccent(instance.jsonb->>'contributors')) @@ tsquery_phrase(f_unaccent('Bach, Johann Sebastian')) AND id in (select t.id from (select id as id, jsonb_array_elements(instance.jsonb->'contributors') as c ) as t where (get_tsvector(f_unaccent(t.c->>'name')) @@ tsquery_phrase(f_unaccent('Bach, Johann Sebastian'))))) AND (SELECT COUNT(*) FROM headrecords) < 100 ), totalCount AS (SELECT fs09000000_mod_inventory_storage.count_estimate(' SELECT lower(f_unaccent(jsonb->>''title'')) AS data_column FROM fs09000000_mod_inventory_storage.instance WHERE get_tsvector(f_unaccent(instance.jsonb->>''contributors'')) @@ tsquery_phrase(f_unaccent(''Bach, Johann Sebastian'')) AND id in (select t.id from (select id as id, jsonb_array_elements(instance.jsonb->''contributors'') as c ) as t where (get_tsvector(f_unaccent(t.c->>''name'')) @@ tsquery_phrase(f_unaccent(''Bach, Johann Sebastian''))))') AS count) SELECT jsonb, data_column, (SELECT count FROM totalCount) FROM headrecords WHERE (SELECT COUNT(*) FROM headrecords) >= 100 UNION (SELECT jsonb, data_column, (SELECT count FROM totalCount) FROM allrecords ORDER BY data_column LIMIT 100 OFFSET 0 ) ORDER BY data_column > 2021-02-09T00:32:51.927-05:00 Sort (cost=19386.36..19386.37 rows=2 width=72) (actual time=4322.451..4322.455 rows=100 loops=1) > 2021-02-09T00:32:51.927-05:00 Sort Key: headrecords.data_column > 2021-02-09T00:32:51.927-05:00 Sort Method: quicksort Memory: 176kB > 2021-02-09T00:32:51.927-05:00 CTE headrecords > 2021-02-09T00:32:51.927-05:00 -> Limit (cost=18790.44..18790.96 rows=1 width=1135) (actual time=1856.703..1856.823 rows=10 loops=1) > 2021-02-09T00:32:51.927-05:00 InitPlan 2 (returns $3) > 2021-02-09T00:32:51.927-05:00 -> Limit (cost=18193.43..18195.25 rows=1 width=32) (actual time=141.494..141.495 rows=1 loops=1) > 2021-02-09T00:32:51.927-05:00 -> Index Scan using instance_title_idx on instance (cost=0.68..13995980.19 rows=7693163 width=32) (actual time=0.086..140.694 rows=10001 loops=1) > 2021-02-09T00:32:51.927-05:00 -> Result (cost=595.18..595.71 rows=1 width=1135) (actual time=1856.702..1856.820 rows=10 loops=1) > 2021-02-09T00:32:51.927-05:00 -> Sort (cost=595.18..595.19 rows=1 width=1103) (actual time=1856.585..1856.587 rows=10 loops=1) > 2021-02-09T00:32:51.927-05:00 Sort Key: ("left"(lower(f_unaccent((instance_1.jsonb ->> 'title'::text))), 600)) > 2021-02-09T00:32:51.927-05:00 Sort Method: quicksort Memory: 41kB > 2021-02-09T00:32:51.927-05:00 -> Bitmap Heap Scan on instance instance_1 (cost=564.00..595.17 rows=1 width=1103) (actual time=1573.951..1856.562 rows=10 loops=1) > 2021-02-09T00:32:51.927-05:00 Recheck Cond: (to_tsvector('simple'::regconfig, translate(f_unaccent((jsonb ->> 'contributors'::text)), '&'::text, ','::text)) @@ '''bach'' <-> ''johann'' <-> ''sebastian'''::tsquery) > 2021-02-09T00:32:51.927-05:00 Rows Removed by Index Recheck: 18 > 2021-02-09T00:32:51.927-05:00 Filter: (("left"(lower(f_unaccent((jsonb ->> 'title'::text))), 600) < $3) AND (SubPlan 1)) > 2021-02-09T00:32:51.927-05:00 Rows Removed by Filter: 6570 > 2021-02-09T00:32:51.927-05:00 Heap Blocks: exact=5713 > 2021-02-09T00:32:51.927-05:00 -> Bitmap Index Scan on instance_contributors_idx_ft (cost=0.00..564.00 rows=1 width=0) (actual time=3.337..3.337 rows=6619 loops=1) > 2021-02-09T00:32:51.927-05:00 Index Cond: (to_tsvector('simple'::regconfig, translate(f_unaccent((jsonb ->> 'contributors'::text)), '&'::text, ','::text)) @@ '''bach'' <-> ''johann'' <-> ''sebastian'''::tsquery) > 2021-02-09T00:32:51.927-05:00 SubPlan 1 > 2021-02-09T00:32:51.927-05:00 -> Subquery Scan on t (cost=0.00..52.27 rows=1 width=16) (actual time=0.038..0.038 rows=1 loops=10) > 2021-02-09T00:32:51.927-05:00 Filter: (to_tsvector('simple'::regconfig, translate(f_unaccent((t.c ->> 'name'::text)), '&'::text, ','::text)) @@ '''bach'' <-> ''johann'' <-> ''sebastian'''::tsquery) > 2021-02-09T00:32:51.927-05:00 -> ProjectSet (cost=0.00..0.52 rows=100 width=48) (actual time=0.010..0.010 rows=1 loops=10) > 2021-02-09T00:32:51.927-05:00 -> Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.000..0.000 rows=1 loops=10) > 2021-02-09T00:32:51.927-05:00 CTE allrecords > 2021-02-09T00:32:51.927-05:00 -> Result (cost=564.04..594.95 rows=1 width=1103) (actual time=4.357..1922.573 rows=6580 loops=1) > 2021-02-09T00:32:51.927-05:00 One-Time Filter: ($8 < 100) > 2021-02-09T00:32:51.927-05:00 InitPlan 5 (returns $8) > 2021-02-09T00:32:51.927-05:00 -> Aggregate (cost=0.02..0.03 rows=1 width=8) (actual time=0.008..0.009 rows=1 loops=1) > 2021-02-09T00:32:51.927-05:00 -> CTE Scan on headrecords headrecords_1 (cost=0.00..0.02 rows=1 width=0) (actual time=0.002..0.006 rows=10 loops=1) > 2021-02-09T00:32:51.927-05:00 -> Bitmap Heap Scan on instance instance_2 (cost=564.04..594.95 rows=1 width=1103) (actual time=4.278..1804.976 rows=6580 loops=1) > 2021-02-09T00:32:51.927-05:00 Recheck Cond: (to_tsvector('simple'::regconfig, translate(f_unaccent((jsonb ->> 'contributors'::text)), '&'::text, ','::text)) @@ '''bach'' <-> ''johann'' <-> ''sebastian'''::tsquery) > 2021-02-09T00:32:51.927-05:00 Rows Removed by Index Recheck: 18 > 2021-02-09T00:32:51.927-05:00 Filter: (SubPlan 4) > 2021-02-09T00:32:51.927-05:00 Heap Blocks: exact=5713 > 2021-02-09T00:32:51.927-05:00 -> Bitmap Index Scan on instance_contributors_idx_ft (cost=0.00..564.00 rows=1 width=0) (actual time=3.364..3.364 rows=6619 loops=1) > 2021-02-09T00:32:51.927-05:00 Index Cond: (to_tsvector('simple'::regconfig, translate(f_unaccent((jsonb ->> 'contributors'::text)), '&'::text, ','::text)) @@ '''bach'' <-> ''johann'' <-> ''sebastian'''::tsquery) > 2021-02-09T00:32:51.927-05:00 SubPlan 4 > 2021-02-09T00:32:51.927-05:00 -> Subquery Scan on t_1 (cost=0.00..52.27 rows=1 width=16) (actual time=0.031..0.031 rows=1 loops=6580) > 2021-02-09T00:32:51.927-05:00 Filter: (to_tsvector('simple'::regconfig, translate(f_unaccent((t_1.c ->> 'name'::text)), '&'::text, ','::text)) @@ '''bach'' <-> ''johann'' <-> ''sebastian'''::tsquery) > 2021-02-09T00:32:51.927-05:00 Rows Removed by Filter: 1 > 2021-02-09T00:32:51.927-05:00 -> ProjectSet (cost=0.00..0.52 rows=100 width=48) (actual time=0.015..0.015 rows=2 loops=6580) > 2021-02-09T00:32:51.927-05:00 -> Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.000..0.000 rows=1 loops=6580) > 2021-02-09T00:32:51.927-05:00 CTE totalcount > 2021-02-09T00:32:51.927-05:00 -> Result (cost=0.00..0.26 rows=1 width=8) (actual time=519.542..519.543 rows=1 loops=1) > 2021-02-09T00:32:51.927-05:00 -> Unique (cost=0.16..0.18 rows=2 width=72) (actual time=4322.223..4322.256 rows=100 loops=1) > 2021-02-09T00:32:51.927-05:00 -> Sort (cost=0.16..0.17 rows=2 width=72) (actual time=4322.223..4322.228 rows=100 loops=1) > 2021-02-09T00:32:51.927-05:00 Sort Key: headrecords.jsonb, headrecords.data_column, ($12) > 2021-02-09T00:32:51.927-05:00 Sort Method: quicksort Memory: 176kB > 2021-02-09T00:32:51.927-05:00 -> Append (cost=0.06..0.15 rows=2 width=72) (actual time=4315.855..4315.876 rows=100 loops=1) > 2021-02-09T00:32:51.927-05:00 -> Result (cost=0.06..0.08 rows=1 width=72) (actual time=1856.854..1856.854 rows=0 loops=1) > 2021-02-09T00:32:51.927-05:00 One-Time Filter: ($13 >= 100) > 2021-02-09T00:32:51.927-05:00 InitPlan 9 (returns $12) > 2021-02-09T00:32:51.927-05:00 -> CTE Scan on totalcount totalcount_1 (cost=0.00..0.02 rows=1 width=8) (never executed) > 2021-02-09T00:32:51.927-05:00 InitPlan 10 (returns $13) > 2021-02-09T00:32:51.927-05:00 -> Aggregate (cost=0.02..0.03 rows=1 width=8) (actual time=1856.852..1856.852 rows=1 loops=1) > 2021-02-09T00:32:51.927-05:00 -> CTE Scan on headrecords headrecords_2 (cost=0.00..0.02 rows=1 width=0) (actual time=1856.706..1856.847 rows=10 loops=1) > 2021-02-09T00:32:51.927-05:00 -> CTE Scan on headrecords (cost=0.06..0.08 rows=1 width=72) (never executed) > 2021-02-09T00:32:51.927-05:00 -> Limit (cost=0.05..0.06 rows=1 width=72) (actual time=2458.999..2459.013 rows=100 loops=1) > 2021-02-09T00:32:51.927-05:00 InitPlan 8 (returns $11) > 2021-02-09T00:32:51.927-05:00 -> CTE Scan on totalcount (cost=0.00..0.02 rows=1 width=8) (actual time=519.544..519.545 rows=1 loops=1) > 2021-02-09T00:32:51.927-05:00 -> Sort (cost=0.03..0.04 rows=1 width=72) (actual time=2458.998..2459.005 rows=100 loops=1) > 2021-02-09T00:32:51.927-05:00 Sort Key: allrecords.data_column > 2021-02-09T00:32:51.927-05:00 Sort Method: top-N heapsort Memory: 181kB > 2021-02-09T00:32:51.927-05:00 -> CTE Scan on allrecords (cost=0.00..0.02 rows=1 width=72) (actual time=523.906..2453.386 rows=6580 loops=1) > 2021-02-09T00:32:51.927-05:00 Planning time: 1.954 ms > 2021-02-09T00:32:51.927-05:00 Execution time: 4323.819 ms