Limit (cost=247673.90..247952.38 rows=35 width=250) (actual time=7172.567..7172.846 rows=35 loops=1) Output: t9._idrref, t9._marked, (CASE WHEN (t9._predefinedid > '\\x00000000000000000000000000000000'::bytea) THEN true ELSE false END), (CASE WHEN (CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x00000052'::bytea ELSE NULL::bytea END = '\\x00000052'::bytea) THEN CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x08'::bytea ELSE NULL::bytea END WHEN ((CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x08'::bytea ELSE NULL::bytea END = '\\x01'::bytea) AND (CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x00000052'::bytea ELSE NULL::bytea END = '\\x00000000'::bytea) AND (t10._fld6001rref = '\\x00000000000000000000000000000000'::bytea)) THEN '\\x01'::bytea ELSE NULL::bytea END), (CASE WHEN (CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x00000052'::bytea ELSE NULL::bytea END = '\\x00000052'::bytea) THEN t10._fld6001rref WHEN ((CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x08'::bytea ELSE NULL::bytea END = '\\x01'::bytea) AND (CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x00000052'::bytea ELSE NULL::bytea END = '\\x00000000'::bytea) AND (t10._fld6001rref = '\\x00000000000000000000000000000000'::bytea)) THEN '\\x00000000000000000000000000000000'::bytea ELSE NULL::bytea END), t9._fld669rref, t9._fld670rref, t9._fld5993rref, t9._fld671, t9._fld672, t9._code, t9._description, t9._fld5994, t9._fld707rref Buffers: shared hit=2963173 read=468570 -> Nested Loop Left Join (cost=247673.90..268249.45 rows=2586 width=250) (actual time=7172.566..7172.843 rows=35 loops=1) Output: t9._idrref, t9._marked, CASE WHEN (t9._predefinedid > '\\x00000000000000000000000000000000'::bytea) THEN true ELSE false END, CASE WHEN (CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x00000052'::bytea ELSE NULL::bytea END = '\\x00000052'::bytea) THEN CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x08'::bytea ELSE NULL::bytea END WHEN ((CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x08'::bytea ELSE NULL::bytea END = '\\x01'::bytea) AND (CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x00000052'::bytea ELSE NULL::bytea END = '\\x00000000'::bytea) AND (t10._fld6001rref = '\\x00000000000000000000000000000000'::bytea)) THEN '\\x01'::bytea ELSE NULL::bytea END, CASE WHEN (CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x00000052'::bytea ELSE NULL::bytea END = '\\x00000052'::bytea) THEN t10._fld6001rref WHEN ((CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x08'::bytea ELSE NULL::bytea END = '\\x01'::bytea) AND (CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x00000052'::bytea ELSE NULL::bytea END = '\\x00000000'::bytea) AND (t10._fld6001rref = '\\x00000000000000000000000000000000'::bytea)) THEN '\\x00000000000000000000000000000000'::bytea ELSE NULL::bytea END, t9._fld669rref, t9._fld670rref, t9._fld5993rref, t9._fld671, t9._fld672, t9._code, t9._description, t9._fld5994, t9._fld707rref Inner Unique: true Join Filter: (t9._fld707rref = t15._idrref) Rows Removed by Join Filter: 35 Filter: ((hashed SubPlan 1) OR ((CASE WHEN (CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x00000052'::bytea ELSE NULL::bytea END = '\\x00000052'::bytea) THEN CASE WHEN (t11._description IS NOT NULL) THEN '\\x05'::bytea ELSE NULL::bytea END WHEN ((CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x08'::bytea ELSE NULL::bytea END = '\\x01'::bytea) AND (CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x00000052'::bytea ELSE NULL::bytea END = '\\x00000000'::bytea) AND (t10._fld6001rref = '\\x00000000000000000000000000000000'::bytea)) THEN '\\x01'::bytea ELSE NULL::bytea END = '\\x05'::bytea) AND (CASE WHEN (CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x00000052'::bytea ELSE NULL::bytea END = '\\x00000052'::bytea) THEN t11._description WHEN ((CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x08'::bytea ELSE NULL::bytea END = '\\x01'::bytea) AND (CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x00000052'::bytea ELSE NULL::bytea END = '\\x00000000'::bytea) AND (t10._fld6001rref = '\\x00000000000000000000000000000000'::bytea)) THEN ''::mvarchar ELSE NULL::mvarchar END ~~ '%ном%'::mvarchar)) OR ((CASE WHEN (CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x00000052'::bytea ELSE NULL::bytea END = '\\x00000052'::bytea) THEN CASE WHEN (t11._fld1196 IS NOT NULL) THEN '\\x05'::bytea ELSE NULL::bytea END WHEN ((CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x08'::bytea ELSE NULL::bytea END = '\\x01'::bytea) AND (CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x00000052'::bytea ELSE NULL::bytea END = '\\x00000000'::bytea) AND (t10._fld6001rref = '\\x00000000000000000000000000000000'::bytea)) THEN '\\x01'::bytea ELSE NULL::bytea END = '\\x05'::bytea) AND (CASE WHEN (CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x00000052'::bytea ELSE NULL::bytea END = '\\x00000052'::bytea) THEN t11._fld1196 WHEN ((CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x08'::bytea ELSE NULL::bytea END = '\\x01'::bytea) AND (CASE WHEN (t10._fld6001rref IS NOT NULL) THEN '\\x00000052'::bytea ELSE NULL::bytea END = '\\x00000000'::bytea) AND (t10._fld6001rref = '\\x00000000000000000000000000000000'::bytea)) THEN ''::mvarchar ELSE NULL::mvarchar END ~~ '%ном%'::mvarchar)) OR ((t9._code)::mvarchar ~~ '%ном%'::mvarchar) OR ((t9._description)::mvarchar ~~ '%ном%'::mvarchar) OR ((t12._description)::mvarchar ~~ '%ном%'::mvarchar) OR ((t13._description)::mvarchar ~~ '%ном%'::mvarchar) OR ((t14._fld1105)::mvarchar ~~ '%ном%'::mvarchar) OR ((t9._fld5994)::mvarchar ~~ '%ном%'::mvarchar) OR ((t15._description)::mvarchar ~~ '%ном%'::mvarchar)) Buffers: shared hit=2963173 read=468570 -> Nested Loop Left Join (cost=0.34..20351.58 rows=5000 width=379) (actual time=0.060..0.257 rows=35 loops=1) Output: t9._idrref, t9._marked, t9._predefinedid, t9._fld669rref, t9._fld670rref, t9._fld5993rref, t9._fld671, t9._fld672, t9._code, t9._description, t9._fld5994, t9._fld707rref, t10._fld6001rref, t11._description, t11._fld1196, t12._description, t13._description, t14._fld1105 Inner Unique: true Join Filter: (t9._fld5993rref = t14._idrref) Rows Removed by Join Filter: 96 Buffers: shared hit=142 read=8 -> Nested Loop Left Join (cost=0.34..20290.50 rows=5000 width=347) (actual time=0.054..0.239 rows=35 loops=1) Output: t9._idrref, t9._marked, t9._predefinedid, t9._fld669rref, t9._fld670rref, t9._fld5993rref, t9._fld671, t9._fld672, t9._code, t9._description, t9._fld5994, t9._fld707rref, t10._fld6001rref, t11._description, t11._fld1196, t12._description, t13._description Inner Unique: true Join Filter: (t9._fld670rref = t13._idrref) Rows Removed by Join Filter: 420 Buffers: shared hit=141 read=8 -> Nested Loop Left Join (cost=0.34..20229.37 rows=5000 width=315) (actual time=0.047..0.204 rows=35 loops=1) Output: t9._idrref, t9._marked, t9._predefinedid, t9._fld669rref, t9._fld670rref, t9._fld5993rref, t9._fld671, t9._fld672, t9._code, t9._description, t9._fld5994, t9._fld707rref, t10._fld6001rref, t11._description, t11._fld1196, t12._description Inner Unique: true Join Filter: (t9._fld669rref = t12._idrref) Rows Removed by Join Filter: 70 Buffers: shared hit=140 read=8 -> Nested Loop Left Join (cost=0.34..20168.23 rows=5000 width=283) (actual time=0.042..0.188 rows=35 loops=1) Output: t9._idrref, t9._marked, t9._predefinedid, t9._fld669rref, t9._fld670rref, t9._fld5993rref, t9._fld671, t9._fld672, t9._code, t9._description, t9._fld5994, t9._fld707rref, t10._fld6001rref, t11._description, t11._fld1196 Inner Unique: true Join Filter: (t10._fld6001rref = t11._idrref) Rows Removed by Join Filter: 245 Buffers: shared hit=139 read=8 -> Nested Loop Left Join (cost=0.34..20107.01 rows=5000 width=219) (actual time=0.028..0.152 rows=35 loops=1) Output: t9._idrref, t9._marked, t9._predefinedid, t9._fld669rref, t9._fld670rref, t9._fld5993rref, t9._fld671, t9._fld672, t9._code, t9._description, t9._fld5994, t9._fld707rref, t10._fld6001rref Buffers: shared hit=138 read=8 -> Index Scan Backward using _reference5975_2 on public._reference5975 t9 (cost=0.17..3338.11 rows=5000 width=202) (actual time=0.017..0.030 rows=35 loops=1) Output: t9._idrref, t9._version, t9._marked, t9._predefinedid, t9._code, t9._description, t9._fld5993rref, t9._fld5997rref, t9._fld5994, t9._fld5995rref, t9._fld5996, t9._fld668, t9._fld669rref, t9._fld670rref, t9._fld671, t9._fld672, t9._fld673, t9._fld313, t9._fld707rref, t9._fld708_type, t9._fld708_rtref, t9._fld708_rrref Index Cond: ((t9._fld313 = '0'::numeric) AND (t9._code < '0000000092'::mvarchar)) Buffers: shared hit=4 read=2 -> Index Scan using _reference5975_vt5998_sk on public._reference5975_vt5998 t10 (cost=0.17..3.34 rows=1 width=34) (actual time=0.003..0.003 rows=1 loops=35) Output: t10._reference5975_idrref, t10._fld313, t10._keyfield, t10._lineno5999, t10._fld6000rref, t10._fld6001rref, t10._fld6002rref, t10._fld6003 Index Cond: ((t10._fld313 = '0'::numeric) AND (t10._reference5975_idrref = t9._idrref)) Filter: ((NOT t10._fld6003) AND (t10._fld6000rref = '\\xa3a5005056010c2a11ed7b1d8de08252'::bytea)) Rows Removed by Filter: 1 Buffers: shared hit=134 read=6 -> Materialize (cost=0.00..1.22 rows=1 width=96) (actual time=0.000..0.001 rows=8 loops=35) Output: t11._idrref, t11._description, t11._fld1196 Buffers: shared hit=1 -> Seq Scan on public._reference82 t11 (cost=0.00..1.22 rows=1 width=96) (actual time=0.005..0.009 rows=20 loops=1) Output: t11._idrref, t11._description, t11._fld1196 Filter: (t11._fld313 = '0'::numeric) Buffers: shared hit=1 -> Materialize (cost=0.00..1.13 rows=1 width=64) (actual time=0.000..0.000 rows=3 loops=35) Output: t12._idrref, t12._description Buffers: shared hit=1 -> Seq Scan on public._reference113 t12 (cost=0.00..1.13 rows=1 width=64) (actual time=0.003..0.004 rows=3 loops=1) Output: t12._idrref, t12._description Filter: (t12._fld313 = '0'::numeric) Buffers: shared hit=1 -> Materialize (cost=0.00..1.13 rows=1 width=64) (actual time=0.000..0.000 rows=12 loops=35) Output: t13._idrref, t13._description Buffers: shared hit=1 -> Seq Scan on public._reference113 t13 (cost=0.00..1.13 rows=1 width=64) (actual time=0.001..0.003 rows=12 loops=1) Output: t13._idrref, t13._description Filter: (t13._fld313 = '0'::numeric) Buffers: shared hit=1 -> Materialize (cost=0.00..1.08 rows=1 width=64) (actual time=0.000..0.000 rows=4 loops=35) Output: t14._idrref, t14._fld1105 Buffers: shared hit=1 -> Seq Scan on public._reference73 t14 (cost=0.00..1.08 rows=1 width=64) (actual time=0.002..0.003 rows=7 loops=1) Output: t14._idrref, t14._fld1105 Filter: (t14._fld313 = '0'::numeric) Buffers: shared hit=1 -> Materialize (cost=0.00..1.03 rows=1 width=64) (actual time=0.000..0.000 rows=2 loops=35) Output: t15._idrref, t15._description Buffers: shared hit=1 -> Seq Scan on public._reference141 t15 (cost=0.00..1.03 rows=1 width=64) (actual time=0.002..0.002 rows=2 loops=1) Output: t15._idrref, t15._description Filter: (t15._fld313 = '0'::numeric) Buffers: shared hit=1 SubPlan 1 -> Index Scan using _reference5975_vt6004_1 on public._reference5975_vt6004 t16 (cost=0.22..247672.38 rows=1182 width=20) (actual time=7172.478..7172.478 rows=0 loops=1) Output: t16._reference5975_idrref Index Cond: ((t16._fld313 = '0'::numeric) AND (t16._fld6007_type = '\\x05'::bytea) AND (t16._fld6007_l = false) AND (t16._fld6007_n = '0'::numeric) AND (t16._fld6007_t = '0001-01-01 00:00:00'::timestamp without time zone) AND (t16._fld6007_rtref = '\\x00000000'::bytea) AND (t16._fld6007_rrref = '\\x00000000000000000000000000000000'::bytea)) Filter: (((t16._fld6007_s)::mvarchar ~~ '%ном%'::mvarchar) AND (t16._fld6006rref = '\\xa3a8005056010c2a11ed82cc6b07e271'::bytea)) Rows Removed by Filter: 3749617 Buffers: shared hit=2963030 read=468562 Planning Time: 0.941 ms Execution Time: 7172.892 ms