set enable_material = off;
|
set enable_memoize = off;
|
set geqo = off;
|
set from_collapse_limit = 16;
|
set jit = off;
|
set join_collapse_limit = 16;
|
set pg_hint_plan.collect_all_hints = on;
|
set pg_hint_plan.force_innerrel_update_table = on;
|
/*+Set(enable_indexscan on)*/
|
explain (costs false)
|
select /*+IndexOnlyScan(t0)*/ t0.c0 from tab0 t0
|
join tab3 t3 on t0.c0 = t3.c3
|
union all
|
select /*+IndexScan(t0)*/ t1.c1 from tab1 t1
|
join tab4 t0 on t1.c1 = t0.c4
|
;
|
QUERY PLAN
|
-----------------------------------------------------------
|
Gather
|
Workers Planned: 1
|
Single Copy: true
|
-> Parallel Append
|
-> Merge Join
|
Merge Cond: (t0.c4 = t1.c1)
|
-> Index Scan using idx4 on tab4 t0
|
-> Sort
|
Sort Key: t1.c1
|
-> Seq Scan on tab1 t1
|
-> Merge Join
|
Merge Cond: (t0_1.c0 = t3.c3)
|
-> Index Only Scan using idx0 on tab0 t0_1
|
-> Sort
|
Sort Key: t3.c3
|
-> Seq Scan on tab3 t3
|
(16 rows)
|
|
/*+Set(enable_indexscan on)*/
|
explain (costs false)
|
select /*+IndexOnlyScan(t0)*/ t0.c0 from tab0 t0
|
join tab3 t3 on t0.c0 = t3.c3
|
union all
|
select /*+IndexScan(t0)*/ t1.c1 from tab1 t1
|
join tab4 t0 on t1.c1 = t0.c4
|
union all
|
select t5.c5 from tab5 t5
|
join tab6 t6 on t5.c5 = t6.c6
|
;
|
QUERY PLAN
|
-----------------------------------------------------------
|
Gather
|
Workers Planned: 1
|
Single Copy: true
|
-> Parallel Append
|
-> Merge Join
|
Merge Cond: (t0.c4 = t1.c1)
|
-> Index Scan using idx4 on tab4 t0
|
-> Sort
|
Sort Key: t1.c1
|
-> Seq Scan on tab1 t1
|
-> Merge Join
|
Merge Cond: (t5.c5 = t6.c6)
|
-> Index Only Scan using idx5 on tab5 t5
|
-> Sort
|
Sort Key: t6.c6
|
-> Seq Scan on tab6 t6
|
-> Merge Join
|
Merge Cond: (t0_1.c0 = t3.c3)
|
-> Index Only Scan using idx0 on tab0 t0_1
|
-> Sort
|
Sort Key: t3.c3
|
-> Seq Scan on tab3 t3
|
(22 rows)
|
|
/*+Set(enable_indexscan on) Set(enable_indexscan on) Set(enable_indexscan on)
|
Set(aaa on) IndexScan(t0)
|
*/
|
explain (costs false)
|
select /*+IndexOnlyScan(t0)*/ t0.c0 from tab0 t0
|
join tab3 t3 on t0.c0 = t3.c3
|
union all
|
select /*+IndexScan(t0) Set(bbb on)*/ t1.c1 from tab1 t1
|
join tab4 t0 on t1.c1 = t0.c4
|
union all
|
select /*+IndexOnlyScan(t6) Set(ccc on)*/ t5.c5 from tab5 t5
|
join tab6 t6 on t5.c5 = t6.c6
|
;
|
INFO: unrecognized configuration parameter "aaa"
|
INFO: unrecognized configuration parameter "bbb"
|
INFO: unrecognized configuration parameter "ccc"
|
QUERY PLAN
|
-----------------------------------------------------------
|
Gather
|
Workers Planned: 1
|
Single Copy: true
|
-> Parallel Append
|
-> Merge Join
|
Merge Cond: (t0.c4 = t1.c1)
|
-> Index Scan using idx4 on tab4 t0
|
-> Sort
|
Sort Key: t1.c1
|
-> Seq Scan on tab1 t1
|
-> Merge Join
|
Merge Cond: (t6.c6 = t5.c5)
|
-> Index Only Scan using idx6 on tab6 t6
|
-> Sort
|
Sort Key: t5.c5
|
-> Seq Scan on tab5 t5
|
-> Merge Join
|
Merge Cond: (t0_1.c0 = t3.c3)
|
-> Index Only Scan using idx0 on tab0 t0_1
|
-> Sort
|
Sort Key: t3.c3
|
-> Seq Scan on tab3 t3
|
(22 rows)
|
|
/*+Set(enable_indexscan on)
|
BitmapScan(t5)
|
*/
|
explain (costs false)
|
select /*+IndexOnlyScan(t0)*/ t0.c0 from tab0 t0
|
join tab3 t3 on t0.c0 = t3.c3
|
union all
|
select /*+IndexScan(t0)*/ t1.c1 from tab1 t1
|
join tab4 t0 on t1.c1 = t0.c4
|
union all
|
select t5.c5 from tab5 t5
|
join tab6 t6 on t5.c5 = t6.c6
|
;
|
QUERY PLAN
|
-----------------------------------------------------------
|
Gather
|
Workers Planned: 1
|
Single Copy: true
|
-> Parallel Append
|
-> Nested Loop
|
-> Seq Scan on tab6 t6
|
-> Bitmap Heap Scan on tab5 t5
|
Recheck Cond: (c5 = t6.c6)
|
-> Bitmap Index Scan on idx5
|
Index Cond: (c5 = t6.c6)
|
-> Merge Join
|
Merge Cond: (t0.c4 = t1.c1)
|
-> Index Scan using idx4 on tab4 t0
|
-> Sort
|
Sort Key: t1.c1
|
-> Seq Scan on tab1 t1
|
-> Merge Join
|
Merge Cond: (t0_1.c0 = t3.c3)
|
-> Index Only Scan using idx0 on tab0 t0_1
|
-> Sort
|
Sort Key: t3.c3
|
-> Seq Scan on tab3 t3
|
(22 rows)
|
|
/*+Set(enable_indexscan on)
|
Set(enable_mergejoin off)
|
*/
|
/*!BitmapScan(t5)
|
*/
|
explain (costs false)
|
select /*+IndexOnlyScan(t0)*/ t0.c0 from tab0 t0
|
join tab3 t3 on t0.c0 = t3.c3
|
union all
|
select /*+IndexScan(t0)*/ t1.c1 from tab1 t1
|
join tab4 t0 on t1.c1 = t0.c4
|
union all
|
select t5.c5 from tab5 t5
|
join tab6 t6 on t5.c5 = t6.c6
|
union all
|
select t0.c8 from tab8 t0
|
join tab9 t9 on t0.c8 = t9.c9
|
;
|
QUERY PLAN
|
-----------------------------------------------------------
|
Gather
|
Workers Planned: 1
|
Single Copy: true
|
-> Parallel Append
|
-> Nested Loop
|
-> Seq Scan on tab6 t6
|
-> Bitmap Heap Scan on tab5 t5
|
Recheck Cond: (c5 = t6.c6)
|
-> Bitmap Index Scan on idx5
|
Index Cond: (c5 = t6.c6)
|
-> Hash Join
|
Hash Cond: (t0.c4 = t1.c1)
|
-> Index Scan using idx4 on tab4 t0
|
-> Hash
|
-> Seq Scan on tab1 t1
|
-> Hash Join
|
Hash Cond: (t0_1.c8 = t9.c9)
|
-> Index Scan using idx8 on tab8 t0_1
|
-> Hash
|
-> Seq Scan on tab9 t9
|
-> Hash Join
|
Hash Cond: (t0_2.c0 = t3.c3)
|
-> Index Only Scan using idx0 on tab0 t0_2
|
-> Hash
|
-> Seq Scan on tab3 t3
|
(25 rows)
|
|
/*+ IndexScan(t0)(70,80)
|
Set(enable_mergejoin off)
|
*/
|
explain (costs false)
|
select t0.c0 from tab0 t0
|
join tab3 t3 on t0.c0 = t3.c3
|
union all
|
select t1.c1 from tab1 t1
|
join tab4 t0 on t1.c1 = t0.c4
|
union all
|
select t5.c5 from tab5 t5
|
join tab6 t6 on t5.c5 = t6.c6
|
;
|
QUERY PLAN
|
------------------------------------------------------
|
Gather
|
Workers Planned: 1
|
Single Copy: true
|
-> Parallel Append
|
-> Hash Join
|
Hash Cond: (t0.c4 = t1.c1)
|
-> Index Scan using idx4 on tab4 t0
|
-> Hash
|
-> Seq Scan on tab1 t1
|
-> Hash Join
|
Hash Cond: (t0_1.c0 = t3.c3)
|
-> Index Scan using idx0 on tab0 t0_1
|
-> Hash
|
-> Seq Scan on tab3 t3
|
-> Hash Join
|
Hash Cond: (t5.c5 = t6.c6)
|
-> Seq Scan on tab5 t5
|
-> Hash
|
-> Seq Scan on tab6 t6
|
(19 rows)
|
|
/*+Set(enable_indexscan on)*/
|
explain (costs false)
|
select /*+IndexOnlyScan(t0 idx0)*/ t0.c0 from tab0 t0
|
join tab3 t3 on t0.c0 = t3.c3
|
union all
|
select /*+IndexScan(t0 idx4)*/ t1.c1 from tab1 t1
|
join tab4 t0 on t1.c1 = t0.c4
|
;
|
QUERY PLAN
|
-----------------------------------------------------------
|
Gather
|
Workers Planned: 1
|
Single Copy: true
|
-> Parallel Append
|
-> Merge Join
|
Merge Cond: (t0.c4 = t1.c1)
|
-> Index Scan using idx4 on tab4 t0
|
-> Sort
|
Sort Key: t1.c1
|
-> Seq Scan on tab1 t1
|
-> Merge Join
|
Merge Cond: (t0_1.c0 = t3.c3)
|
-> Index Only Scan using idx0 on tab0 t0_1
|
-> Sort
|
Sort Key: t3.c3
|
-> Seq Scan on tab3 t3
|
(16 rows)
|
|
/*+Set(enable_indexscan on)*/
|
explain (costs false)
|
select /*+MergeJoin(t0 t3)*/ t0.c0 from tab0 t0
|
join tab3 t3 on t0.c0 = t3.c3
|
;
|
QUERY PLAN
|
---------------------------------------------
|
Merge Join
|
Merge Cond: (t0.c0 = t3.c3)
|
-> Index Only Scan using idx0 on tab0 t0
|
-> Sort
|
Sort Key: t3.c3
|
-> Seq Scan on tab3 t3
|
(6 rows)
|
|
/*+Set(enable_indexscan on)*/
|
explain (costs false)
|
select /*+NestLoop(t0 t3)*/ t0.c0 from tab0 t0
|
join tab3 t3 on t0.c0 = t3.c3
|
union all
|
select /*+MergeJoin(t1 t0)*/ t1.c1 from tab1 t1
|
join tab4 t0 on t1.c1 = t0.c4
|
;
|
QUERY PLAN
|
---------------------------------------------------------
|
Gather
|
Workers Planned: 1
|
Single Copy: true
|
-> Parallel Append
|
-> Nested Loop
|
-> Seq Scan on tab0 t0
|
-> Index Only Scan using idx3 on tab3 t3
|
Index Cond: (c3 = t0.c0)
|
-> Merge Join
|
Merge Cond: (t1.c1 = t0_1.c4)
|
-> Index Only Scan using idx1 on tab1 t1
|
-> Sort
|
Sort Key: t0_1.c4
|
-> Seq Scan on tab4 t0_1
|
(14 rows)
|
|
/*+Set(enable_indexscan on)*/
|
explain (costs false)
|
select /*+IndexOnlyScan(t0)*/ t0.c0,
|
(
|
select /*+IndexScan(t0)*/ max(t0.c1)
|
from tab1 t0
|
)
|
as tmp1
|
from tab0 t0
|
;
|
QUERY PLAN
|
-------------------------------------------------------------------
|
Index Only Scan using idx0 on tab0 t0
|
InitPlan 2 (returns $1)
|
-> Result
|
InitPlan 1 (returns $0)
|
-> Limit
|
-> Index Scan Backward using idx1 on tab1 t0_1
|
Index Cond: (c1 IS NOT NULL)
|
(7 rows)
|
|
/*+Set(enable_indexscan on)*/
|
explain (costs false)
|
select /*+IndexOnlyScan(t0)*/ t0.c0,
|
coalesce (
|
(
|
select /*+IndexScan(t0)*/ max(t0.c1)
|
from tab1 t0
|
where t0.c1 < 0
|
)
|
, 888
|
)
|
as tmp2
|
from tab0 t0
|
;
|
QUERY PLAN
|
---------------------------------------------------------------------
|
Index Only Scan using idx0 on tab0 t0
|
InitPlan 2 (returns $1)
|
-> Result
|
InitPlan 1 (returns $0)
|
-> Limit
|
-> Index Scan Backward using idx1 on tab1 t0_1
|
Index Cond: ((c1 IS NOT NULL) AND (c1 < 0))
|
(7 rows)
|
|
/*+Set(enable_indexscan on)*/
|
explain (costs false)
|
select /*+IndexOnlyScan(t0)*/ t0.c0
|
from tab0 t0
|
where t0.c0 in
|
(
|
select /*+IndexScan(t0)*/ t0.c1
|
from tab1 t0
|
)
|
;
|
QUERY PLAN
|
------------------------------------------------------
|
Hash Join
|
Hash Cond: (t0.c0 = t0_1.c1)
|
-> Index Only Scan using idx0 on tab0 t0
|
-> Hash
|
-> HashAggregate
|
Group Key: t0_1.c1
|
-> Index Scan using idx1 on tab1 t0_1
|
(7 rows)
|
|
/*+Set(enable_indexscan on)*/
|
explain (costs false)
|
insert into tab19 (c19)
|
select /*+IndexOnlyScan(t0)*/ t0.c0
|
from tab0 t0
|
where t0.c0 in
|
(
|
select /*+IndexScan(t0)*/ t0.c1
|
from tab1 t0
|
)
|
;
|
QUERY PLAN
|
------------------------------------------------------------
|
Insert on tab19
|
-> Hash Join
|
Hash Cond: (t0.c0 = t0_1.c1)
|
-> Index Only Scan using idx0 on tab0 t0
|
-> Hash
|
-> HashAggregate
|
Group Key: t0_1.c1
|
-> Index Scan using idx1 on tab1 t0_1
|
(8 rows)
|
|
/*+Set(enable_indexscan on)*/
|
explain (costs false)
|
select /*+IndexOnlyScan(t0)*/ t0.c0
|
from tab0 t0
|
where exists
|
(
|
select /*+IndexScan(t1)*/ t1.c1
|
from tab1 t1
|
where t1.c1 = t0.c0
|
)
|
;
|
QUERY PLAN
|
----------------------------------------------------
|
Hash Join
|
Hash Cond: (t0.c0 = t1.c1)
|
-> Index Only Scan using idx0 on tab0 t0
|
-> Hash
|
-> HashAggregate
|
Group Key: t1.c1
|
-> Index Scan using idx1 on tab1 t1
|
(7 rows)
|
|
/*+Set(enable_indexscan on)*/
|
explain (costs false)
|
select /*+IndexOnlyScan(t0)*/ t0.c0
|
from tab0 t0
|
where exists
|
(
|
select /*+IndexScan(t0)*/ t0.c1
|
from tab1 t0
|
where t0.c1 = 777
|
)
|
;
|
QUERY PLAN
|
---------------------------------------------
|
Result
|
One-Time Filter: $0
|
InitPlan 1 (returns $0)
|
-> Index Scan using idx1 on tab1 t0_1
|
Index Cond: (c1 = 777)
|
-> Index Only Scan using idx0 on tab0 t0
|
(6 rows)
|
|
-------------------------------------------------------ForceOrder()
|
/*+
|
ForceOrder()
|
*/
|
explain (costs false)
|
with sub_query as
|
(
|
select t0.c0 from tab0 t0
|
join tab1 t1 on t0.c0 = t1.c1
|
join tab2 t2 on t1.c1 = t2.c2
|
join tab3 t3 on t2.c2 = t3.c3
|
join tab4 t4 on t3.c3 = t4.c4
|
join tab5 t5 on t4.c4 = t5.c5
|
join tab6 t6 on t5.c5 = t6.c6
|
join tab7 t7 on t6.c6 = t7.c7
|
join tab8 t8 on t7.c7 = t8.c8
|
join tab9 t9 on t8.c8 = t9.c9
|
join tab10 t10 on t9.c9 = t10.c10
|
join tab11 t11 on t10.c10 = t11.c11
|
)
|
select * from sub_query
|
;
|
QUERY PLAN
|
---------------------------------------------------------------------------------------------------------
|
Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Seq Scan on tab0 t0
|
-> Index Only Scan using idx1 on tab1 t1
|
Index Cond: (c1 = t0.c0)
|
-> Index Only Scan using idx2 on tab2 t2
|
Index Cond: (c2 = t0.c0)
|
-> Index Only Scan using idx3 on tab3 t3
|
Index Cond: (c3 = t0.c0)
|
-> Index Only Scan using idx4 on tab4 t4
|
Index Cond: (c4 = t0.c0)
|
-> Index Only Scan using idx5 on tab5 t5
|
Index Cond: (c5 = t0.c0)
|
-> Index Only Scan using idx6 on tab6 t6
|
Index Cond: (c6 = t0.c0)
|
-> Index Only Scan using idx7 on tab7 t7
|
Index Cond: (c7 = t0.c0)
|
-> Index Only Scan using idx8 on tab8 t8
|
Index Cond: (c8 = t0.c0)
|
-> Index Only Scan using idx9 on tab9 t9
|
Index Cond: (c9 = t0.c0)
|
-> Index Only Scan using idx10 on tab10 t10
|
Index Cond: (c10 = t0.c0)
|
-> Index Only Scan using idx11 on tab11 t11
|
Index Cond: (c11 = t0.c0)
|
(34 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
select * from tab0 t0
|
where exists
|
(
|
select t13.c13 from tab13 t13
|
where t13.c13 in
|
(
|
select t14.c14 from tab14 t14
|
-- where 1=1
|
where t14.c14 not in
|
(
|
select t1.c1 from tab1 t1
|
join tab2 t2 on t1.c1 = t2.c2
|
join tab3 t3 on t2.c2 = t3.c3
|
join tab4 t4 on t3.c3 = t4.c4
|
join tab5 t5 on t4.c4 = t5.c5
|
join tab6 t6 on t5.c5 = t6.c6
|
join tab7 t7 on t6.c6 = t7.c7
|
join tab8 t8 on t7.c7 = t8.c8
|
join tab9 t9 on t8.c8 = t9.c9
|
join tab10 t10 on t9.c9 = t10.c10
|
join tab11 t11 on t10.c10 = t11.c11
|
join tab12 t12 on t11.c11 = t12.c12
|
)
|
)
|
)
|
or t0.c0 = any
|
(
|
select t1.c1 from tab1 t1
|
join tab2 t2 on t1.c1 = t2.c2
|
join tab3 t3 on t2.c2 = t3.c3
|
join tab4 t4 on t3.c3 = t4.c4
|
join tab5 t5 on t4.c4 = t5.c5
|
join tab6 t6 on t5.c5 = t6.c6
|
join tab7 t7 on t6.c6 = t7.c7
|
join tab8 t8 on t7.c7 = t8.c8
|
join tab9 t9 on t8.c8 = t9.c9
|
join tab10 t10 on t9.c9 = t10.c10
|
join tab11 t11 on t10.c10 = t11.c11
|
join tab12 t12 on t11.c11 = t12.c12
|
)
|
;;
|
QUERY PLAN
|
------------------------------------------------------------------------------------------------------------------
|
Seq Scan on tab0 t0
|
Filter: ($6 OR (SubPlan 3))
|
InitPlan 2 (returns $6)
|
-> Nested Loop Semi Join
|
-> Seq Scan on tab13 t13
|
-> Index Only Scan using idx14 on tab14 t14
|
Index Cond: (c14 = t13.c13)
|
Filter: (NOT (SubPlan 1))
|
SubPlan 1
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
Join Filter: (t1.c1 = t8.c8)
|
-> Nested Loop
|
Join Filter: (t1.c1 = t7.c7)
|
-> Nested Loop
|
Join Filter: (t1.c1 = t6.c6)
|
-> Nested Loop
|
Join Filter: (t1.c1 = t5.c5)
|
-> Nested Loop
|
Join Filter: (t1.c1 = t4.c4)
|
-> Nested Loop
|
Join Filter: (t1.c1 = t3.c3)
|
-> Nested Loop
|
Join Filter: (t1.c1 = t2.c2)
|
-> Seq Scan on tab1 t1
|
-> Seq Scan on tab2 t2
|
-> Seq Scan on tab3 t3
|
-> Seq Scan on tab4 t4
|
-> Seq Scan on tab5 t5
|
-> Seq Scan on tab6 t6
|
-> Seq Scan on tab7 t7
|
-> Seq Scan on tab8 t8
|
-> Index Only Scan using idx9 on tab9 t9
|
Index Cond: (c9 = t1.c1)
|
-> Index Only Scan using idx10 on tab10 t10
|
Index Cond: (c10 = t1.c1)
|
-> Index Only Scan using idx11 on tab11 t11
|
Index Cond: (c11 = t1.c1)
|
-> Index Only Scan using idx12 on tab12 t12
|
Index Cond: (c12 = t1.c1)
|
SubPlan 3
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
Join Filter: (t1_1.c1 = t8_1.c8)
|
-> Nested Loop
|
Join Filter: (t1_1.c1 = t7_1.c7)
|
-> Nested Loop
|
Join Filter: (t1_1.c1 = t6_1.c6)
|
-> Nested Loop
|
Join Filter: (t1_1.c1 = t5_1.c5)
|
-> Nested Loop
|
Join Filter: (t1_1.c1 = t4_1.c4)
|
-> Nested Loop
|
Join Filter: (t1_1.c1 = t3_1.c3)
|
-> Nested Loop
|
Join Filter: (t1_1.c1 = t2_1.c2)
|
-> Seq Scan on tab1 t1_1
|
-> Seq Scan on tab2 t2_1
|
-> Seq Scan on tab3 t3_1
|
-> Seq Scan on tab4 t4_1
|
-> Seq Scan on tab5 t5_1
|
-> Seq Scan on tab6 t6_1
|
-> Seq Scan on tab7 t7_1
|
-> Seq Scan on tab8 t8_1
|
-> Index Only Scan using idx9 on tab9 t9_1
|
Index Cond: (c9 = t1_1.c1)
|
-> Index Only Scan using idx10 on tab10 t10_1
|
Index Cond: (c10 = t1_1.c1)
|
-> Index Only Scan using idx11 on tab11 t11_1
|
Index Cond: (c11 = t1_1.c1)
|
-> Index Only Scan using idx12 on tab12 t12_1
|
Index Cond: (c12 = t1_1.c1)
|
(78 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
select t1.c1 from tab1 t1
|
join tab2 t2 on t1.c1 = t2.c2
|
join tab3 t3 on t2.c2 = t3.c3
|
join tab4 t4 on t3.c3 = t4.c4
|
;
|
QUERY PLAN
|
---------------------------------------------------------
|
Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Seq Scan on tab1 t1
|
-> Index Only Scan using idx2 on tab2 t2
|
Index Cond: (c2 = t1.c1)
|
-> Index Only Scan using idx3 on tab3 t3
|
Index Cond: (c3 = t1.c1)
|
-> Index Only Scan using idx4 on tab4 t4
|
Index Cond: (c4 = t1.c1)
|
(10 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
select t1.c1
|
from tab1 t1, tab2 t2, tab3 t3, tab4 t4, tab5 t5, tab6 t6, tab7 t7, tab8 t8, tab9 t9, tab10 t10, tab11 t11, tab12 t12
|
where t1.c1 = t2.c2 and t2.c2 = t3.c3 and t3.c3 = t4.c4 and t4.c4 = t5.c5 and t5.c5 = t6.c6
|
and t6.c6 = t7.c7 and t7.c7 = t8.c8 and t8.c8 = t9.c9 and t9.c9 = t10.c10
|
and t10.c10 = t11.c11 and t11.c11 = t12.c12
|
;
|
QUERY PLAN
|
---------------------------------------------------------------------------------------------------------
|
Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Seq Scan on tab1 t1
|
-> Index Only Scan using idx2 on tab2 t2
|
Index Cond: (c2 = t1.c1)
|
-> Index Only Scan using idx3 on tab3 t3
|
Index Cond: (c3 = t1.c1)
|
-> Index Only Scan using idx4 on tab4 t4
|
Index Cond: (c4 = t1.c1)
|
-> Index Only Scan using idx5 on tab5 t5
|
Index Cond: (c5 = t1.c1)
|
-> Index Only Scan using idx6 on tab6 t6
|
Index Cond: (c6 = t1.c1)
|
-> Index Only Scan using idx7 on tab7 t7
|
Index Cond: (c7 = t1.c1)
|
-> Index Only Scan using idx8 on tab8 t8
|
Index Cond: (c8 = t1.c1)
|
-> Index Only Scan using idx9 on tab9 t9
|
Index Cond: (c9 = t1.c1)
|
-> Index Only Scan using idx10 on tab10 t10
|
Index Cond: (c10 = t1.c1)
|
-> Index Only Scan using idx11 on tab11 t11
|
Index Cond: (c11 = t1.c1)
|
-> Index Only Scan using idx12 on tab12 t12
|
Index Cond: (c12 = t1.c1)
|
(34 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
select t0.c0
|
from tab0 t0, tab1 t1, tab2 t2, tab3 t3, tab4 t4, tab5 t5, tab6 t6, tab7 t7, tab8 t8, tab9 t9, tab10 t10, tab11 t11, tab12 t12, tab13 t13, tab14 t14
|
where t0.c0 = t1.c1 and t1.c1 = t2.c2 and t2.c2 = t3.c3 and t3.c3 = t4.c4 and t4.c4 = t5.c5 and t5.c5 = t6.c6
|
and t6.c6 = t7.c7 and t7.c7 = t8.c8 and t8.c8 = t9.c9 and t9.c9 = t10.c10
|
and t10.c10 = t11.c11 and t11.c11 = t12.c12 and t12.c12 = t13.c13 and t13.c13 = t14.c14
|
;
|
QUERY PLAN
|
---------------------------------------------------------------------------------------------------------------------------
|
Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Seq Scan on tab0 t0
|
-> Index Only Scan using idx1 on tab1 t1
|
Index Cond: (c1 = t0.c0)
|
-> Index Only Scan using idx2 on tab2 t2
|
Index Cond: (c2 = t0.c0)
|
-> Index Only Scan using idx3 on tab3 t3
|
Index Cond: (c3 = t0.c0)
|
-> Index Only Scan using idx4 on tab4 t4
|
Index Cond: (c4 = t0.c0)
|
-> Index Only Scan using idx5 on tab5 t5
|
Index Cond: (c5 = t0.c0)
|
-> Index Only Scan using idx6 on tab6 t6
|
Index Cond: (c6 = t0.c0)
|
-> Index Only Scan using idx7 on tab7 t7
|
Index Cond: (c7 = t0.c0)
|
-> Index Only Scan using idx8 on tab8 t8
|
Index Cond: (c8 = t0.c0)
|
-> Index Only Scan using idx9 on tab9 t9
|
Index Cond: (c9 = t0.c0)
|
-> Index Only Scan using idx10 on tab10 t10
|
Index Cond: (c10 = t0.c0)
|
-> Index Only Scan using idx11 on tab11 t11
|
Index Cond: (c11 = t0.c0)
|
-> Index Only Scan using idx12 on tab12 t12
|
Index Cond: (c12 = t0.c0)
|
-> Index Only Scan using idx13 on tab13 t13
|
Index Cond: (c13 = t0.c0)
|
-> Index Only Scan using idx14 on tab14 t14
|
Index Cond: (c14 = t0.c0)
|
(43 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
select
|
t0.c0,
|
(select min(t1.c1) from tab1 t1
|
join tab2 t2 on t1.c1 = t2.c2
|
join tab3 t3 on t2.c2 = t3.c3
|
join tab4 t4 on t3.c3 = t4.c4
|
join tab5 t5 on t4.c4 = t5.c5
|
)
|
as cc2
|
from tab0 t0
|
;
|
QUERY PLAN
|
-----------------------------------------------------------------------------
|
Seq Scan on tab0 t0
|
InitPlan 1 (returns $4)
|
-> Aggregate
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Seq Scan on tab1 t1
|
-> Index Only Scan using idx2 on tab2 t2
|
Index Cond: (c2 = t1.c1)
|
-> Index Only Scan using idx3 on tab3 t3
|
Index Cond: (c3 = t1.c1)
|
-> Index Only Scan using idx4 on tab4 t4
|
Index Cond: (c4 = t1.c1)
|
-> Index Only Scan using idx5 on tab5 t5
|
Index Cond: (c5 = t1.c1)
|
(16 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
select t1.c1,
|
case
|
when exists (
|
select 1 from tab3 t3
|
where t3.c3 = t1.c1
|
) then 10
|
else 0
|
end
|
+
|
case
|
when exists (
|
select 1 from tab2 t2
|
where t2.c2 = t1.c1
|
) then 1
|
else 0
|
end
|
as cc2
|
from tab0 t0
|
join tab1 t1 on t1.c1 = t0.c0
|
where t1.c1 >= 5
|
;
|
QUERY PLAN
|
--------------------------------------------------
|
Nested Loop
|
-> Seq Scan on tab0 t0
|
-> Index Only Scan using idx1 on tab1 t1
|
Index Cond: ((c1 = t0.c0) AND (c1 >= 5))
|
SubPlan 2
|
-> Seq Scan on tab3 t3
|
SubPlan 4
|
-> Seq Scan on tab2 t2
|
(8 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
select t1.c1,
|
case
|
when exists (
|
select 1 from tab3 t3
|
where t3.c3 = t1.c1
|
) then 10
|
else 0
|
end
|
+
|
case
|
when exists (
|
select 1 from tab2 t2
|
where t2.c2 = t1.c1
|
) then 1
|
else 0
|
end
|
-
|
case
|
when exists (
|
select 1 from tab4 t4
|
where t4.c4 = t1.c1
|
and t4.c4 in
|
(
|
select t5.c5 from tab5 t5
|
join tab6 t6 on t6.c6 = t5.c5
|
)
|
) then 7
|
else 0
|
end
|
as cc2
|
from tab0 t0
|
join tab1 t1 on t1.c1 = t0.c0
|
where t1.c1 >= 5
|
;
|
QUERY PLAN
|
-----------------------------------------------------------
|
Nested Loop
|
-> Seq Scan on tab0 t0
|
-> Index Only Scan using idx1 on tab1 t1
|
Index Cond: ((c1 = t0.c0) AND (c1 >= 5))
|
SubPlan 2
|
-> Seq Scan on tab3 t3
|
SubPlan 4
|
-> Seq Scan on tab2 t2
|
SubPlan 6
|
-> Nested Loop Semi Join
|
-> Seq Scan on tab4 t4
|
-> Nested Loop
|
Join Filter: (t4.c4 = t6.c6)
|
-> Index Only Scan using idx5 on tab5 t5
|
Index Cond: (c5 = t4.c4)
|
-> Index Only Scan using idx6 on tab6 t6
|
Index Cond: (c6 = t5.c5)
|
(17 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
select t0.c0 from tab0 t0
|
join tab3 t3 on t0.c0 = t3.c3
|
join tab2 t2 on t0.c0 = t2.c2
|
join tab1 t1 on t0.c0 = t1.c1
|
;
|
QUERY PLAN
|
---------------------------------------------------------
|
Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Seq Scan on tab0 t0
|
-> Index Only Scan using idx3 on tab3 t3
|
Index Cond: (c3 = t0.c0)
|
-> Index Only Scan using idx2 on tab2 t2
|
Index Cond: (c2 = t0.c0)
|
-> Index Only Scan using idx1 on tab1 t1
|
Index Cond: (c1 = t0.c0)
|
(10 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
select t0.c0
|
from tab0 t0, tab1 t1, tab2 t2, tab3 t3
|
where t0.c0 = t1.c1 and t1.c1 = t2.c2 and t2.c2 = t3.c3
|
;
|
QUERY PLAN
|
---------------------------------------------------------
|
Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Seq Scan on tab0 t0
|
-> Index Only Scan using idx1 on tab1 t1
|
Index Cond: (c1 = t0.c0)
|
-> Index Only Scan using idx2 on tab2 t2
|
Index Cond: (c2 = t0.c0)
|
-> Index Only Scan using idx3 on tab3 t3
|
Index Cond: (c3 = t0.c0)
|
(10 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
select t0.c0
|
from tab1 t1, tab3 t3, tab2 t2, tab0 t0
|
where t0.c0 = t1.c1 and t1.c1 = t2.c2 and t2.c2 = t3.c3
|
;
|
QUERY PLAN
|
---------------------------------------------------------
|
Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Seq Scan on tab1 t1
|
-> Index Only Scan using idx3 on tab3 t3
|
Index Cond: (c3 = t1.c1)
|
-> Index Only Scan using idx2 on tab2 t2
|
Index Cond: (c2 = t1.c1)
|
-> Index Only Scan using idx0 on tab0 t0
|
Index Cond: (c0 = t1.c1)
|
(10 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
select t0.c0
|
from tab0 t0, tab1 t1
|
join tab2 t2 on t1.c1 = t2.c2
|
join tab3 t3 on t2.c2 = t3.c3
|
where t0.c0 = t1.c1
|
;
|
QUERY PLAN
|
---------------------------------------------------------
|
Nested Loop
|
Join Filter: (t0.c0 = t1.c1)
|
-> Seq Scan on tab0 t0
|
-> Nested Loop
|
-> Nested Loop
|
-> Seq Scan on tab1 t1
|
-> Index Only Scan using idx2 on tab2 t2
|
Index Cond: (c2 = t1.c1)
|
-> Index Only Scan using idx3 on tab3 t3
|
Index Cond: (c3 = t1.c1)
|
(10 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
select t0.c0 from tab0 t0
|
join tab2 t2 on t0.c0 = t2.c2
|
join tab1 t1 on t0.c0 = t1.c1
|
join tab3 t3 on t2.c2 = t3.c3
|
union all
|
select t0.c0 from tab0 t0
|
join tab3 t3 on t0.c0 = t3.c3
|
join tab1 t1 on t0.c0 = t1.c1
|
join tab2 t2 on t0.c0 = t2.c2
|
;
|
QUERY PLAN
|
-----------------------------------------------------------------------
|
Gather
|
Workers Planned: 1
|
Single Copy: true
|
-> Parallel Append
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Seq Scan on tab0 t0
|
-> Index Only Scan using idx3 on tab3 t3
|
Index Cond: (c3 = t0.c0)
|
-> Index Only Scan using idx1 on tab1 t1
|
Index Cond: (c1 = t0.c0)
|
-> Index Only Scan using idx2 on tab2 t2
|
Index Cond: (c2 = t0.c0)
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Seq Scan on tab0 t0_1
|
-> Index Only Scan using idx2 on tab2 t2_1
|
Index Cond: (c2 = t0_1.c0)
|
-> Index Only Scan using idx1 on tab1 t1_1
|
Index Cond: (c1 = t0_1.c0)
|
-> Index Only Scan using idx3 on tab3 t3_1
|
Index Cond: (c3 = t0_1.c0)
|
(24 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
select t0.c0
|
from tab1 t1,
|
tab3 t3,
|
tab0 t0
|
join tab2 t2 on t2.c2 = t0.c0
|
where t0.c0 = t1.c1 and t1.c1 = t3.c3
|
;
|
QUERY PLAN
|
---------------------------------------------------
|
Nested Loop
|
Join Filter: (t1.c1 = t2.c2)
|
-> Nested Loop
|
-> Seq Scan on tab1 t1
|
-> Index Only Scan using idx3 on tab3 t3
|
Index Cond: (c3 = t1.c1)
|
-> Nested Loop
|
-> Seq Scan on tab0 t0
|
-> Index Only Scan using idx2 on tab2 t2
|
Index Cond: (c2 = t0.c0)
|
(10 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
select t0.c0
|
from tab1 t1,
|
tab3 t3
|
join tab4 t4 on t4.c4 = t3.c3,
|
tab0 t0
|
join tab2 t2 on t2.c2 = t0.c0
|
where t0.c0 = t1.c1 and t1.c1 = t3.c3
|
;
|
QUERY PLAN
|
---------------------------------------------------------
|
Nested Loop
|
Join Filter: (t1.c1 = t2.c2)
|
-> Nested Loop
|
Join Filter: (t1.c1 = t4.c4)
|
-> Seq Scan on tab1 t1
|
-> Nested Loop
|
-> Seq Scan on tab3 t3
|
-> Index Only Scan using idx4 on tab4 t4
|
Index Cond: (c4 = t3.c3)
|
-> Nested Loop
|
-> Seq Scan on tab0 t0
|
-> Index Only Scan using idx2 on tab2 t2
|
Index Cond: (c2 = t0.c0)
|
(13 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
select 1 from tab4 t4
|
where t4.c4 = 5
|
and t4.c4 in
|
(
|
select t5.c5 from tab5 t5
|
join tab6 t6 on t6.c6 = t5.c5
|
)
|
;
|
QUERY PLAN
|
---------------------------------------------
|
Nested Loop Semi Join
|
-> Bitmap Heap Scan on tab4 t4
|
Recheck Cond: (c4 = 5)
|
-> Bitmap Index Scan on idx4
|
Index Cond: (c4 = 5)
|
-> Nested Loop
|
-> Bitmap Heap Scan on tab5 t5
|
Recheck Cond: (c5 = 5)
|
-> Bitmap Index Scan on idx5
|
Index Cond: (c5 = 5)
|
-> Bitmap Heap Scan on tab6 t6
|
Recheck Cond: (c6 = 5)
|
-> Bitmap Index Scan on idx6
|
Index Cond: (c6 = 5)
|
(14 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
select t0.c0 from tab0 t0
|
join tab1 t1 on t0.c0 = t1.c1
|
join tab2 t2 on t1.c1 = t2.c2
|
join tab3 t3 on t2.c2 = t3.c3
|
join tab11 t11 on t0.c0 = t11.c11
|
join tab12 t12 on t0.c0 = t12.c12
|
;
|
QUERY PLAN
|
---------------------------------------------------------------------
|
Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Seq Scan on tab0 t0
|
-> Index Only Scan using idx1 on tab1 t1
|
Index Cond: (c1 = t0.c0)
|
-> Index Only Scan using idx2 on tab2 t2
|
Index Cond: (c2 = t0.c0)
|
-> Index Only Scan using idx3 on tab3 t3
|
Index Cond: (c3 = t0.c0)
|
-> Index Only Scan using idx11 on tab11 t11
|
Index Cond: (c11 = t0.c0)
|
-> Index Only Scan using idx12 on tab12 t12
|
Index Cond: (c12 = t0.c0)
|
(16 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
update tab2 t2
|
set c2 = t4.c4
|
from tab0 t0
|
inner join tab4 t4 on t0.c0 = t4.c4
|
where t2.c2 = t0.c0
|
;
|
QUERY PLAN
|
----------------------------------------------------
|
Update on tab2 t2
|
-> Nested Loop
|
Join Filter: (t2.c2 = t0.c0)
|
-> Seq Scan on tab2 t2
|
-> Nested Loop
|
-> Seq Scan on tab0 t0
|
-> Index Scan using idx4 on tab4 t4
|
Index Cond: (c4 = t0.c0)
|
(8 rows)
|
|
/*! ForceOrder() */
|
explain (costs false)
|
delete from tab2
|
where c2 in
|
(
|
select t2.c2
|
from tab4 t4, tab2 t2
|
where t2.c2 = t4.c4
|
)
|
;
|
QUERY PLAN
|
----------------------------------------------------------
|
Delete on tab2
|
-> Nested Loop Semi Join
|
-> Seq Scan on tab2
|
-> Nested Loop
|
Join Filter: (tab2.c2 = t2.c2)
|
-> Index Scan using idx4 on tab4 t4
|
Index Cond: (c4 = tab2.c2)
|
-> Index Scan using idx2 on tab2 t2
|
Index Cond: (c2 = t4.c4)
|
(9 rows)
|
|
-------------------------------------------------------stand
|
--stand_query_001
|
/*! ForceOrder() */
|
explain (costs false)
|
DELETE
|
FROM pLastDate2
|
WHERE pLastDate2.ctid IN (
|
SELECT ld.ctid
|
FROM pRest2 r
|
INNER JOIN pLastDate2 ld
|
ON ld.ResourceID = r.ResourceID AND ld.FundID = r.FundID AND ld.SPID = 2109098
|
WHERE r.SPID = 2109098)
|
;
|
QUERY PLAN
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Delete on plastdate2
|
-> Nested Loop
|
-> HashAggregate
|
Group Key: ld.ctid
|
-> Nested Loop
|
-> Index Scan using prest2_xpktrest on prest2 r
|
Index Cond: ((spid)::numeric = '2109098'::numeric)
|
-> Index Scan using plastdate2_xpkplastdate2 on plastdate2 ld
|
Index Cond: (((spid)::numeric = '2109098'::numeric) AND ((resourceid)::numeric = (r.resourceid)::numeric) AND ((fundid)::numeric = (r.fundid)::numeric))
|
-> Tid Scan on plastdate2
|
TID Cond: (ctid = ld.ctid)
|
(11 rows)
|
|
--stand_query_002
|
/*! ForceOrder() */
|
explain (costs false)
|
UPDATE pRest2 tab__update
|
SET Rest = Rest.Rest + r.Rest
|
,RestBs = Rest.RestBs + r.RestBs
|
,LastDate = CASE WHEN (abs(Rest.TurnDeb) + abs(Rest.TurnCre) > 0) THEN '2010-08-31 00:00:00' ELSE r.LastDate END
|
FROM pRest2 Rest
|
INNER JOIN pLastDate2 pl
|
ON pl.SPID = 2109098 AND pl.ResourceID = Rest.ResourceID AND pl.FundID = Rest.FundID
|
INNER JOIN tRest r
|
ON r.AccountingType = 1 AND r.Date = pl.LastDate AND r.ResourceID = Rest.ResourceID AND r.FundID = Rest.FundID AND r.InstitutionID = 2000
|
WHERE tab__update.ctid = Rest.ctid AND (Rest.SPID = 2109098)
|
;
|
QUERY PLAN
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Update on prest2 tab__update
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Index Scan using prest2_xpktrest on prest2 rest
|
Index Cond: ((spid)::numeric = '2109098'::numeric)
|
-> Index Scan using plastdate2_xpkplastdate2 on plastdate2 pl
|
Index Cond: (((spid)::numeric = '2109098'::numeric) AND ((resourceid)::numeric = (rest.resourceid)::numeric) AND ((fundid)::numeric = (rest.fundid)::numeric))
|
-> Index Scan using trest_xie6trest on trest r
|
Index Cond: (((accountingtype)::integer = 1) AND ((institutionid)::numeric = '2000'::numeric) AND ((date)::timestamp without time zone = (pl.lastdate)::timestamp without time zone))
|
Filter: (((pl.resourceid)::numeric = (resourceid)::numeric) AND ((pl.fundid)::numeric = (fundid)::numeric))
|
-> Tid Scan on prest2 tab__update
|
TID Cond: (ctid = rest.ctid)
|
(13 rows)
|
|
--stand_query_003
|
/*! ForceOrder() */
|
explain (costs false)
|
INSERT INTO tMMRegAnalytics
|
(
|
MMRegID,
|
MMAnalyticsID
|
)
|
SELECT r.MMRegID,
|
d.MMAnalyticsID
|
FROM pMMRegisterID r, pMMAnalyticMassInsert a, pMMAnalyticDeal2 d, pMMAnalyticMassInsert a2
|
WHERE r.SPID = 2109098 AND a.SPID = r.SPID AND a.LinkID = r.LinkID AND d.SPID = a.SPID AND d.MMAnalyticsTypeID = a.MMAnalyticsTypeID AND d.AnalyticsObjectID = a.AnalyticsObjectID
|
AND a.SPID = a2.SPID AND a.LinkID = a2.LinkID
|
;
|
QUERY PLAN
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Insert on tmmreganalytics
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Bitmap Heap Scan on pmmregisterid r
|
Recheck Cond: ((spid)::numeric = '2109098'::numeric)
|
-> Bitmap Index Scan on pmmregisterid_xpkpmmregisterid
|
Index Cond: ((spid)::numeric = '2109098'::numeric)
|
-> Index Scan using pmmanalyticmassinsert_xpkpmmanalyticmassinsert on pmmanalyticmassinsert a
|
Index Cond: (((spid)::numeric = '2109098'::numeric) AND ((linkid)::numeric = (r.linkid)::numeric))
|
-> Index Scan using pmmanalyticdeal2_xpkpmmanalyticdeal2 on pmmanalyticdeal2 d
|
Index Cond: (((spid)::numeric = '2109098'::numeric) AND ((mmanalyticstypeid)::numeric = (a.mmanalyticstypeid)::numeric) AND ((analyticsobjectid)::numeric = (a.analyticsobjectid)::numeric))
|
-> Index Only Scan using pmmanalyticmassinsert_xpkpmmanalyticmassinsert on pmmanalyticmassinsert a2
|
Index Cond: ((spid = '2109098'::numeric) AND (linkid = (a.linkid)::numeric))
|
(14 rows)
|
|
--stand_query_004
|
/*! ForceOrder() */
|
explain (costs false)
|
INSERT INTO pFX_TermRegister
|
(
|
SPID,
|
ObjectID,
|
MMRegID,
|
Value,
|
LiabType,
|
CurrencyID
|
)
|
SELECT 2109098,
|
p.ObjectID,
|
r.MMRegID,
|
r.Value,
|
a1.AnalyticsObjectID,
|
a2.AnalyticsObjectID
|
FROM pFX_TermDealParam p
|
INNER JOIN tMMReg r
|
ON r.ObjectID = p.ObjectID AND r.ObjectTypeID = 1 AND r.Date = '2010-08-31 00:00:00' AND r.MMRegTypeID = 21
|
INNER JOIN tMMRegAnalytics ra1
|
ON ra1.MMRegID = r.MMRegID
|
INNER JOIN tMMAnalytics a1
|
ON a1.MMAnalyticsID = ra1.MMAnalyticsID AND a1.MMAnalyticsTypeID = 24
|
INNER JOIN tMMRegAnalytics ra2
|
ON ra2.MMRegID = r.MMRegID
|
INNER JOIN tMMAnalytics a2
|
ON a2.MMAnalyticsID = ra2.MMAnalyticsID AND a2.MMAnalyticsTypeID = 2
|
INNER JOIN tMMReg rr
|
ON rr.ObjectID = p.ObjectID AND rr.ObjectTypeID = 1 AND rr.Date = '2010-08-31 00:00:00' AND rr.MMRegTypeID = 22
|
WHERE p.SPID = 2109098
|
;
|
QUERY PLAN
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Insert on pfx_termregister
|
-> Nested Loop
|
Join Filter: ((r.objectid)::numeric = (rr.objectid)::numeric)
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
Join Filter: ((p.objectid)::numeric = (r.objectid)::numeric)
|
-> Index Only Scan using pfx_termdealparam_xpkpfx_termdealparam on pfx_termdealparam p
|
Index Cond: (spid = '2109098'::numeric)
|
-> Index Scan using tmmreg_xie1tmmreg on tmmreg r
|
Index Cond: (((date)::timestamp without time zone = 'Tue Aug 31 00:00:00 2010'::timestamp without time zone) AND ((mmregtypeid)::numeric = '21'::numeric) AND ((objecttypeid)::integer = 1))
|
-> Bitmap Heap Scan on tmmreganalytics ra1
|
Recheck Cond: ((mmregid)::numeric = (r.mmregid)::numeric)
|
-> Bitmap Index Scan on tmmreganalytics_xpktmmreganalytics
|
Index Cond: ((mmregid)::numeric = (r.mmregid)::numeric)
|
-> Index Scan using tmmanalytics_xpktmmanalytics on tmmanalytics a1
|
Index Cond: ((mmanalyticsid)::numeric = (ra1.mmanalyticsid)::numeric)
|
Filter: ((mmanalyticstypeid)::numeric = '24'::numeric)
|
-> Index Only Scan using tmmreganalytics_xpktmmreganalytics on tmmreganalytics ra2
|
Index Cond: (mmregid = (ra1.mmregid)::numeric)
|
-> Index Scan using tmmanalytics_xpktmmanalytics on tmmanalytics a2
|
Index Cond: ((mmanalyticsid)::numeric = (ra2.mmanalyticsid)::numeric)
|
Filter: ((mmanalyticstypeid)::numeric = '2'::numeric)
|
-> Index Scan using tmmreg_xie1tmmreg on tmmreg rr
|
Index Cond: (((date)::timestamp without time zone = 'Tue Aug 31 00:00:00 2010'::timestamp without time zone) AND ((mmregtypeid)::numeric = '22'::numeric) AND ((objecttypeid)::integer = 1))
|
(27 rows)
|
|
--stand_query_005
|
/*! ForceOrder() */
|
explain (costs false)
|
UPDATE pDPT_Accrual_AdvLucre tab__update
|
SET PrcDate = opc.AdvOnDate
|
FROM pDealID_Mark m, pDPT_Accrual_AdvLucre al, pDPT_Accrual_AdvAc opc
|
WHERE tab__update.ctid = al.ctid AND (m.spid = 111 AND al.SPID = m.spid AND al.TemplateNumber = 222 AND al.ObjectID = m.DealID AND opc.SPID = al.SPID AND opc.ObjectID = al.ObjectID AND opc.TemplateNumber = al.TemplateNumber AND opc.AdvOnDate = (
|
SELECT max(opc2.AdvOnDate)
|
FROM pDPT_Accrual_AdvAc opc2
|
WHERE opc2.SPID = al.SPID AND opc2.ObjectID = opc.ObjectID AND opc2.TemplateNumber = al.TemplateNumber AND opc2.AdvOnDate <= m.DateBegin))
|
;
|
QUERY PLAN
|
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Update on pdpt_accrual_advlucre tab__update
|
-> Nested Loop
|
Join Filter: (((al.objectid)::numeric = (opc.objectid)::numeric) AND ((SubPlan 2) = (opc.advondate)::timestamp without time zone))
|
-> Nested Loop
|
Join Filter: ((m.dealid)::numeric = (al.objectid)::numeric)
|
-> Nested Loop
|
+ -> Index Scan using pdealid_mark_xie0pdealid_mark on pdealid_mark m
|
+ Index Cond: ((spid)::numeric = '111'::numeric)
|
+ -> Seq Scan on pdpt_accrual_advlucre tab__update
|
+ -> Tid Scan on pdpt_accrual_advlucre al
|
+ TID Cond: (ctid = tab__update.ctid)
|
+ Filter: (((spid)::numeric = '111'::numeric) AND ((templatenumber)::numeric = '222'::numeric))
|
+ -> Index Scan using pdpt_accrual_advac_xak1pdpt_accrual_advac on pdpt_accrual_advac opc
|
+ Index Cond: (((spid)::numeric = '111'::numeric) AND ((templatenumber)::numeric = '222'::numeric) AND ((objectid)::numeric = (m.dealid)::numeric))
|
+ SubPlan 2
|
+ -> Result
|
+ InitPlan 1 (returns $4)
|
+ -> Limit
|
+ -> Index Only Scan Backward using pdpt_accrual_advac_xpkpdpt_accrual_advac on pdpt_accrual_advac opc2
|
+ Index Cond: ((spid = (al.spid)::numeric) AND (objectid = (opc.objectid)::numeric) AND (templatenumber = (al.templatenumber)::numeric) AND (advondate IS NOT NULL) AND (advondate <= (m.datebegin)::timestamp without time zone))
|
+(20 rows)
|
|
--stand_query_006
|
/*! ForceOrder() */
|
explain (costs false)
|
UPDATE pObject2 tab__update
|
SET ErrorCode = o.RetCode
|
FROM pTmp_DocumentBuffer o
|
INNER JOIN pObject2 ob3
|
ON ob3.SPID = 2109098 AND ob3.ObjectID = o.ObjectID
|
INNER JOIN pObject2 ob4
|
ON ob4.SPID = 2109098 AND ob4.ObjectID = o.ObjectID
|
INNER JOIN pObject2 ob
|
ON ob.SPID = 2109098 AND ob.ObjectID = o.ObjectID
|
WHERE tab__update.ctid = ob.ctid AND (o.RetCode > 0 AND o.RetCode <> 25103)
|
;
|
QUERY PLAN
|
----------------------------------------------------------------------------------------------------------------------------------------
|
Update on pobject2 tab__update
|
-> Nested Loop
|
-> Nested Loop
|
Join Filter: ((ob3.objectid)::numeric = (ob.objectid)::numeric)
|
-> Nested Loop
|
Join Filter: ((ob3.objectid)::numeric = (ob4.objectid)::numeric)
|
-> Nested Loop
|
-> Seq Scan on ptmp_documentbuffer o
|
Filter: (((retcode)::numeric > '0'::numeric) AND ((retcode)::numeric <> '25103'::numeric))
|
-> Index Scan using pobject2_xie1pobject2 on pobject2 ob3
|
Index Cond: (((spid)::numeric = '2109098'::numeric) AND ((objectid)::numeric = (o.objectid)::numeric))
|
-> Index Scan using pobject2_xie1pobject2 on pobject2 ob4
|
Index Cond: (((spid)::numeric = '2109098'::numeric) AND ((objectid)::numeric = (o.objectid)::numeric))
|
-> Index Scan using pobject2_xie1pobject2 on pobject2 ob
|
Index Cond: (((spid)::numeric = '2109098'::numeric) AND ((objectid)::numeric = (o.objectid)::numeric))
|
-> Tid Scan on pobject2 tab__update
|
TID Cond: (ctid = ob.ctid)
|
(17 rows)
|
|
--zip_00240.sql
|
explain (costs false)
|
INSERT INTO pObject
|
(
|
SPID,
|
ObjectID,
|
InstrumentID,
|
ActionID,
|
Date,
|
OperDate,
|
PlanDate
|
)
|
SELECT /*+ IndexScan(a tactionperiod_xie1tactionperiod)
|
IndexScan(dm tdocmark_xpktdocmark)
|
IndexScan(pl tactionplan_xak1tactionplan)
|
IndexScan(p5 ptblcursor5_xpkptblcursor5)
|
IndexScan(ob tobject_xak2tobject)
|
IndexScan(p tprotocol_xpktprotocol)
|
IndexScan(t ttransition_xpkttransition)
|
IndexScan(os toperset_xak1toperset) */
|
/*! ForceOrder() */
|
777/*var__SPID_CONSTANT*/,
|
pl.ObjectID,
|
888/*var_InstrumentID*/,
|
999/*var_ActionID*/,
|
max(pl.FactDate),
|
coalesce(nullif('20000101'/*var_locOperDate*/, '19000101'), '20200101'/*var_locDate*/)::dsoperday,
|
max(pl.PlanDate)
|
FROM tActionPeriod a, tDocMark dm, tActionPlan pl, pTblCursor5 p5, tObject ob, tProtocol p, tTransition t, tOperSet os
|
WHERE a.NodeID = 999/*var_ActionID*/ AND dm.SPID = 777/*var__SPID_CONSTANT*/ AND dm.Type = 555/*var_MarkType*/ AND ob.ID = dm.ID AND ob.InstrumentID = 888/*var_InstrumentID*/ AND p.ProtocolID = ob.CurrProtocolID AND t.TransitionID = p.TransitionID AND os.ParentID = t.TargetStateID AND os.ChildID = 999/*var_ActionID*/ AND pl.ObjectID = dm.ID AND pl.OperDate = '20200101'/*var_locDate*/
|
AND EXISTS( SELECT /*+ IndexScan(pr tperiod_xie1tperiod) */
|
1
|
FROM tPeriod pr
|
WHERE pr.SchemePeriodID = a.SchemePeriodID AND (pr.PeriodAlgorithm <> 5 OR pr.PeriodType <> 1))
|
AND NOT EXISTS( SELECT /*+ IndexScan(p pobject_xpkpobject) */
|
1
|
FROM pObject p
|
WHERE p.SPID = 777/*var__SPID_CONSTANT*/ AND p.ObjectID = pl.ObjectID) AND p5.SPID = 777/*var__SPID_CONSTANT*/ AND p5.Type = 131 AND pl.ActionPeriodID = a.ActionPeriodID AND pl.BranchID = p5.ID AND pl.ObjectID = ob.ID AND pl.BranchID = ob.BranchID AND ob.InstrumentID = 888/*var_InstrumentID*/
|
AND NOT EXISTS( SELECT /*+ IndexScan(e perrorobject_xpkperrorobject) */
|
1
|
FROM pErrorObject e
|
WHERE e.SPID = 777/*var__SPID_CONSTANT*/ AND e.ObjectID = pl.ObjectID AND e.InstrumentID = 888/*var_InstrumentID*/ AND e.NodeID = 999/*var_ActionID*/)
|
GROUP BY
|
pl.ObjectID ORDER BY pl.ObjectID
|
;
|
QUERY PLAN
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Insert on pobject
|
-> Subquery Scan on "*SELECT*"
|
-> GroupAggregate
|
Group Key: pl.objectid
|
-> Nested Loop Anti Join
|
Join Filter: ((e.objectid)::numeric = (pl.objectid)::numeric)
|
-> Nested Loop Anti Join
|
-> Nested Loop Semi Join
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
Join Filter: ((dm.id)::numeric = (ob.id)::numeric)
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Index Scan using tdocmark_xpktdocmark on tdocmark dm
|
Index Cond: (((spid)::numeric = '777'::numeric) AND ((type)::integer = 555))
|
-> Index Scan using tactionperiod_xie1tactionperiod on tactionperiod a
|
Index Cond: ((nodeid)::numeric = '999'::numeric)
|
-> Index Scan using tactionplan_xak1tactionplan on tactionplan pl
|
Index Cond: (((objectid)::numeric = (dm.id)::numeric) AND ((actionperiodid)::numeric = (a.actionperiodid)::numeric))
|
Filter: ((operdate)::timestamp without time zone = 'Wed Jan 01 00:00:00 2020'::timestamp without time zone)
|
-> Index Scan using ptblcursor5_xpkptblcursor5 on ptblcursor5 p5
|
Index Cond: (((spid)::numeric = '777'::numeric) AND ((type)::smallint = 131) AND ((id)::numeric = (pl.branchid)::numeric))
|
-> Index Scan using tobject_xak2tobject on tobject ob
|
Index Cond: (((instrumentid)::numeric = '888'::numeric) AND ((id)::numeric = (pl.objectid)::numeric))
|
Filter: ((pl.branchid)::numeric = (branchid)::numeric)
|
-> Index Scan using tprotocol_xpktprotocol on tprotocol p
|
Index Cond: ((protocolid)::numeric = (ob.currprotocolid)::numeric)
|
-> Index Scan using ttransition_xpkttransition on ttransition t
|
Index Cond: ((transitionid)::numeric = (p.transitionid)::numeric)
|
-> Index Scan using toperset_xak1toperset on toperset os
|
Index Cond: (((parentid)::numeric = (t.targetstateid)::numeric) AND ((childid)::numeric = '999'::numeric))
|
-> Index Scan using tperiod_xie1tperiod on tperiod pr
|
Index Cond: ((schemeperiodid)::numeric = (a.schemeperiodid)::numeric)
|
Filter: (((periodalgorithm)::numeric <> '5'::numeric) OR ((periodtype)::integer <> 1))
|
-> Index Scan using pobject_xpkpobject on pobject p_1
|
Index Cond: (((spid)::numeric = '777'::numeric) AND ((objectid)::numeric = (pl.objectid)::numeric))
|
-> Index Scan using perrorobject_xpkperrorobject on perrorobject e
|
Index Cond: (((spid)::numeric = '777'::numeric) AND ((instrumentid)::numeric = '888'::numeric) AND ((nodeid)::numeric = '999'::numeric))
|
(41 rows)
|
|
--badhint_query
|
explain (costs false)
|
INSERT INTO pAPI_PrmD_IDList
|
(
|
SPID,
|
AccountID,
|
AccountNumber,
|
PrmDID,
|
LinkID
|
)
|
SELECT /*+ IndexScan(p prko_prmd_accidlist_xpkprko_prmd_accidlist)
|
IndexScan(dt tdealtransact_xie9tdealtransact) */
|
/*! ForceOrder() */
|
239710,
|
p.AccountID,
|
p.AccountNumber,
|
dt.DealTransactID,
|
p.FoundedAccID
|
FROM pRKO_PrmD_AccIDList p
|
INNER JOIN tDealTransact dt
|
ON dt.ResourceID = p.FoundedAccID AND dt.Date BETWEEN '19000101 00:00:00' AND '20100831 00:00:00' AND dt.TransactType = 5 AND (1 = 2 OR (1 <> 2 AND dt.Confirmed = 1)) AND (2000 = 0 OR dt.InstitutionID = 2000)
|
WHERE p.SPID = 239710 AND p.FoundedAccID BETWEEN 1 AND 1501
|
UNION ALL
|
SELECT /*+ IndexScan(p prko_prmd_accidlist_xpkprko_prmd_accidlist)
|
IndexScan(dt tdealtransact_xie14tdealtransact) */
|
/*! ForceOrder() */
|
239710,
|
p.AccountID,
|
p.AccountNumber,
|
dt.DealTransactID,
|
p.FoundedAccID
|
FROM pRKO_PrmD_AccIDList p
|
INNER JOIN tDealTransact dt
|
ON dt.ResourcePsvID = p.FoundedAccID AND dt.Date BETWEEN '19000101 00:00:00' AND '20100831 00:00:00' AND dt.TransactType = 5 AND dt.ResourcePsvID <> dt.ResourceID AND (1 = 2 OR (1 <> 2 AND dt.Confirmed = 1)) AND (2000 = 0 OR dt.InstitutionID = 2000)
|
WHERE p.SPID = 239710 AND p.FoundedAccID BETWEEN 1 AND 1501
|
;
|
QUERY PLAN
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Insert on papi_prmd_idlist
|
-> Result
|
-> Append
|
-> Subquery Scan on "*SELECT* 1"
|
-> Nested Loop
|
-> Index Scan using prko_prmd_accidlist_xpkprko_prmd_accidlist on prko_prmd_accidlist p
|
Index Cond: (((spid)::numeric = '239710'::numeric) AND ((foundedaccid)::numeric >= '1'::numeric) AND ((foundedaccid)::numeric <= '1501'::numeric))
|
-> Index Scan using tdealtransact_xie9tdealtransact on tdealtransact dt
|
Index Cond: (((resourceid)::numeric = (p.foundedaccid)::numeric) AND ((date)::timestamp without time zone >= 'Mon Jan 01 00:00:00 1900'::timestamp without time zone) AND ((date)::timestamp without time zone <= 'Tue Aug 31 00:00:00 2010'::timestamp without time zone))
|
Filter: (((transacttype)::smallint = 5) AND ((confirmed)::smallint = 1) AND ((institutionid)::numeric = '2000'::numeric))
|
-> Subquery Scan on "*SELECT* 2"
|
-> Nested Loop
|
-> Index Scan using prko_prmd_accidlist_xpkprko_prmd_accidlist on prko_prmd_accidlist p_1
|
Index Cond: (((spid)::numeric = '239710'::numeric) AND ((foundedaccid)::numeric >= '1'::numeric) AND ((foundedaccid)::numeric <= '1501'::numeric))
|
-> Index Scan using tdealtransact_xie14tdealtransact on tdealtransact dt_1
|
Index Cond: (((resourcepsvid)::numeric = (p_1.foundedaccid)::numeric) AND ((date)::timestamp without time zone >= 'Mon Jan 01 00:00:00 1900'::timestamp without time zone) AND ((date)::timestamp without time zone <= 'Tue Aug 31 00:00:00 2010'::timestamp without time zone))
|
Filter: (((resourcepsvid)::numeric <> (resourceid)::numeric) AND ((transacttype)::smallint = 5) AND ((confirmed)::smallint = 1) AND ((institutionid)::numeric = '2000'::numeric))
|
(17 rows)
|
|
--badforce_query
|
explain (costs false)
|
UPDATE /*+ IndexScan(m pdealid_mark_xie0pdealid_mark)
|
IndexScan(al pdpt_accrual_advlucre_xpkpdpt_accrual_advlucre)
|
IndexScan(opc pdpt_accrual_advac_xpkpdpt_accrual_advac) */
|
/*! ForceOrder() */
|
pDPT_Accrual_AdvLucre tab__update
|
SET PrcDate = opc.AdvOnDate
|
FROM pDealID_Mark m, pDPT_Accrual_AdvLucre al, pDPT_Accrual_AdvAc opc
|
WHERE tab__update.ctid = al.ctid AND (m.spid = 999 AND al.SPID = m.spid AND al.TemplateNumber = 888 AND al.ObjectID = m.DealID AND opc.SPID = al.SPID AND opc.ObjectID = al.ObjectID AND opc.TemplateNumber = al.TemplateNumber AND opc.AdvOnDate = ( SELECT /*+ IndexScan(opc2 pdpt_accrual_advac_xpkpdpt_accrual_advac) */
|
max(opc2.AdvOnDate)
|
FROM pDPT_Accrual_AdvAc opc2
|
WHERE opc2.SPID = al.SPID AND opc2.ObjectID = opc.ObjectID AND opc2.TemplateNumber = al.TemplateNumber AND opc2.AdvOnDate <= m.DateBegin))
|
;
|
QUERY PLAN
|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Update on pdpt_accrual_advlucre tab__update
|
-> Nested Loop
|
Join Filter: (((al.objectid)::numeric = (opc.objectid)::numeric) AND ((SubPlan 2) = (opc.advondate)::timestamp without time zone))
|
-> Nested Loop
|
Join Filter: (tab__update.ctid = al.ctid)
|
-> Nested Loop
|
-> Index Scan using pdealid_mark_xie0pdealid_mark on pdealid_mark m
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Seq Scan on pdpt_accrual_advlucre tab__update
|
-> Index Scan using pdpt_accrual_advlucre_xpkpdpt_accrual_advlucre on pdpt_accrual_advlucre al
|
Index Cond: (((spid)::numeric = '999'::numeric) AND ((objectid)::numeric = (m.dealid)::numeric) AND ((templatenumber)::numeric = '888'::numeric))
|
+ -> Index Scan using pdpt_accrual_advac_xpkpdpt_accrual_advac on pdpt_accrual_advac opc
|
+ Index Cond: (((spid)::numeric = '999'::numeric) AND ((objectid)::numeric = (m.dealid)::numeric) AND ((templatenumber)::numeric = '888'::numeric))
|
+ SubPlan 2
|
+ -> Result
|
+ InitPlan 1 (returns $4)
|
+ -> Limit
|
+ -> Index Scan Backward using pdpt_accrual_advac_xpkpdpt_accrual_advac on pdpt_accrual_advac opc2
|
+ Index Cond: (((spid)::numeric = (al.spid)::numeric) AND ((objectid)::numeric = (opc.objectid)::numeric) AND ((templatenumber)::numeric = (al.templatenumber)::numeric) AND ((advondate)::timestamp without time zone IS NOT NULL) AND ((advondate)::timestamp without time zone <= (m.datebegin)::timestamp without time zone))
|
(19 rows)
|
|
--113_skype.sql
|
explain (costs off)
|
INSERT INTO pAPI_SM_LinkedProtocol
|
(
|
SPID,
|
RelationType,
|
ProtocolID,
|
ObjectID,
|
ObjectTypeID,
|
FinOperID
|
)
|
SELECT /*+ IndexScan(pr tprotocolrelation_xie1tprotocolrelation)
|
IndexScan(p tprotocol_xpktprotocol)
|
IndexScan(o tobject_xpktobject) */
|
/*! ForceOrder() */
|
999,
|
1,
|
pr.ParentID,
|
o.ID,
|
o.ObjectTypeID,
|
o.InstrumentID
|
FROM tProtocolRelation pr
|
INNER JOIN tProtocol p
|
ON p.ProtocolID = pr.ParentID
|
INNER JOIN tObject o
|
ON o.ObjectID = p.ObjectID
|
WHERE pr.ChildID = 888
|
UNION ALL
|
SELECT /*+ IndexScan(pr tprotocolrelation_xpktprotocolrelation)
|
IndexScan(p tprotocol_xpktprotocol)
|
IndexScan(o tobject_xpktobject) */
|
/*! ForceOrder() */
|
999,
|
2,
|
pr.ChildID,
|
o.ID,
|
o.ObjectTypeID,
|
o.InstrumentID
|
FROM tProtocolRelation pr
|
INNER JOIN tProtocol p
|
ON p.ProtocolID = pr.ChildID
|
INNER JOIN tObject o
|
ON o.ObjectID = p.ObjectID
|
WHERE pr.ParentID = 888
|
;
|
QUERY PLAN
|
-----------------------------------------------------------------------------------------------------------------------
|
Insert on papi_sm_linkedprotocol
|
-> Result
|
-> Append
|
-> Subquery Scan on "*SELECT* 1"
|
-> Nested Loop
|
-> Nested Loop
|
-> Index Scan using tprotocolrelation_xie1tprotocolrelation on tprotocolrelation pr
|
Index Cond: ((childid)::numeric = '888'::numeric)
|
-> Index Scan using tprotocol_xpktprotocol on tprotocol p
|
Index Cond: ((protocolid)::numeric = (pr.parentid)::numeric)
|
-> Index Scan using tobject_xpktobject on tobject o
|
Index Cond: ((objectid)::numeric = (p.objectid)::numeric)
|
-> Subquery Scan on "*SELECT* 2"
|
-> Nested Loop
|
-> Nested Loop
|
-> Index Scan using tprotocolrelation_xpktprotocolrelation on tprotocolrelation pr_1
|
Index Cond: ((parentid)::numeric = '888'::numeric)
|
-> Index Scan using tprotocol_xpktprotocol on tprotocol p_1
|
Index Cond: ((protocolid)::numeric = (pr_1.childid)::numeric)
|
-> Index Scan using tobject_xpktobject on tobject o_1
|
Index Cond: ((objectid)::numeric = (p_1.objectid)::numeric)
|
(21 rows)
|
|
--116_skype.sql
|
explain (costs off)
|
INSERT INTO pDPT_Accrual_AdvBase
|
(
|
SPID,
|
ObjectID,
|
BaseValue,
|
Tax,
|
AdvTax,
|
Qty,
|
RefQty,
|
TemplateNumber,
|
BeginDate,
|
EndDate,
|
ProtocolID
|
)
|
SELECT /*+ IndexScan(o papi_accrual_object_xpkpapi_accrual_object)
|
IndexScan(oap pdpt_accrual_advlucre_xpkpdpt_accrual_advlucre)
|
IndexScan(od papi_accrual_date_xpkpapi_accrual_date) */
|
/*! ForceOrder() */
|
999,
|
oap.ObjectID,
|
oap.Value,
|
oap.Prcnt,
|
oap.AdvTax,
|
0,
|
0,
|
888,
|
oap.BeginDate,
|
oap.EndDate,
|
oap.ProtocolID
|
FROM pAPI_Accrual_Object o, pDPT_Accrual_AdvLucre oap, pAPI_Accrual_Date od
|
WHERE o.SPID = 999 AND oap.SPID = o.SPID AND oap.ObjectID = o.ObjectID AND od.SPID = oap.SPID AND od.ObjectID = oap.ObjectID AND od.TemplateNumber = 888 AND oap.BeginDate >= od.BeginDate AND oap.EndDate <= od.EndDate
|
;
|
QUERY PLAN
|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Insert on pdpt_accrual_advbase
|
-> Nested Loop
|
Join Filter: (((oap.begindate)::timestamp without time zone >= (od.begindate)::timestamp without time zone) AND ((oap.enddate)::timestamp without time zone <= (od.enddate)::timestamp without time zone) AND ((oap.objectid)::numeric = (od.objectid)::numeric))
|
-> Nested Loop
|
Join Filter: ((o.objectid)::numeric = (oap.objectid)::numeric)
|
-> Index Scan using papi_accrual_object_xpkpapi_accrual_object on papi_accrual_object o
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Index Scan using pdpt_accrual_advlucre_xpkpdpt_accrual_advlucre on pdpt_accrual_advlucre oap
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Index Scan using papi_accrual_date_xpkpapi_accrual_date on papi_accrual_date od
|
Index Cond: (((spid)::numeric = '999'::numeric) AND ((templatenumber)::numeric = '888'::numeric))
|
(11 rows)
|
|
--115_skype.sql
|
explain (costs off)
|
INSERT INTO pTmp_DocumentBuffer
|
(
|
QtyDeb,
|
FundID,
|
DealProtocolID,
|
InstrumentID,
|
ObjectID,
|
GroupID,
|
OperTemplateID,
|
DealID,
|
Comment,
|
QtyPsv,
|
FundPsvID
|
)
|
SELECT /*+ IndexScan(oqp pqtyobjectmember_xpkpqtyobjectmember)
|
IndexScan(ot palltemplate_xie2palltemplate)
|
IndexScan(dp paccr_object_cprotocol_xpkpaccr_object_cprotocol)
|
IndexScan(otd palltemplatedoc_xie2palltemplatedoc)
|
IndexScan(pd pdocumenttemplate_xpkpdocumenttemplate) */
|
/*! ForceOrder() */
|
coalesce(sum(oqp.Const * oqp.Mult1 * oqp.Mult2 * oqp.Mult3 * oqp.Mult4 * oqp.Mult5 / oqp.Div1 / oqp.Div2 / oqp.Div3 / oqp.Div4 / oqp.Div5)),
|
coalesce(max(oqp.FundID), 0) AS "oqpFundID",
|
dp.CurrProtocolID,
|
222,
|
oqp.ObjectID AS "oqpObjectID",
|
oqp.ObjectID,
|
oqp.OperTemplateID AS "pdOperTemplateID",
|
(1 - sign(55)) * oqp.ObjectID,
|
max(ot.Number) AS "otNumber",
|
0,
|
0
|
FROM pQtyObjectMember oqp, pAllTemplate ot, pACCR_Object_CProtocol dp, pAllTemplateDoc otd, pDocumentTemplate pd
|
WHERE oqp.SPID = CAST(999 AS int) AND oqp.PartNumber = 1 AND oqp.Div1 <> 0 AND oqp.Div2 <> 0 AND oqp.Div3 <> 0 AND oqp.Div4 <> 0 AND oqp.Div5 <> 0 AND dp.SPID = CAST(oqp.spid AS numeric (15, 0)) AND dp.ObjectID = oqp.ObjectID AND dp.FinOperID = 222 AND ot.SPID = CAST(oqp.spid AS numeric (15, 0)) AND ot.OperTemplateID = oqp.OperTemplateID AND otd.SPID = CAST(oqp.spid AS numeric (15, 0)) AND otd.OperTemplateID = oqp.OperTemplateID AND otd.Priority = CAST(333 AS smallint) AND pd.SPID = CAST(oqp.spid AS numeric (15, 0)) AND pd.OperTemplateID = oqp.OperTemplateID AND ((ot.Security = 0) OR (EXISTS( SELECT /*+ IndexScan(oa papi_accrual_objaccount_xie4papi_accrual_objaccount) */
|
1
|
FROM pAPI_Accrual_ObjAccount oa
|
WHERE oa.SPID = CAST(oqp.spid AS numeric (15, 0)) AND oa.ObjectID = oqp.ObjectID AND oa.CrnID = ot.Security)))
|
GROUP BY
|
oqp.ObjectID,
|
oqp.OperTemplateID,
|
dp.CurrProtocolID ORDER BY "oqpObjectID", "otNumber"
|
;
|
QUERY PLAN
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Insert on ptmp_documentbuffer
|
-> Subquery Scan on "*SELECT*"
|
-> Incremental Sort
|
Sort Key: oqp.objectid, (max((ot.number)::bpchar))
|
Presorted Key: oqp.objectid
|
-> GroupAggregate
|
Group Key: oqp.objectid, oqp.opertemplateid, dp.currprotocolid
|
-> Incremental Sort
|
Sort Key: oqp.objectid, oqp.opertemplateid, dp.currprotocolid
|
Presorted Key: oqp.objectid, oqp.opertemplateid
|
-> Nested Loop
|
Join Filter: ((dp.spid)::numeric = (pd.spid)::numeric)
|
-> Nested Loop
|
Join Filter: ((dp.spid)::numeric = (otd.spid)::numeric)
|
-> Nested Loop
|
Join Filter: ((oqp.objectid)::numeric = (dp.objectid)::numeric)
|
-> Nested Loop
|
-> Index Scan using pqtyobjectmember_xpkpqtyobjectmember on pqtyobjectmember oqp
|
Index Cond: (((spid)::integer = 999) AND ((partnumber)::integer = 1))
|
Filter: (((div1)::double precision <> '0'::double precision) AND ((div2)::double precision <> '0'::double precision) AND ((div3)::double precision <> '0'::double precision) AND ((div4)::double precision <> '0'::double precision) AND ((div5)::double precision <> '0'::double precision))
|
-> Index Scan using palltemplate_xie2palltemplate on palltemplate ot
|
Index Cond: (((spid)::numeric = (oqp.spid)::numeric(15,0)) AND ((opertemplateid)::numeric = (oqp.opertemplateid)::numeric))
|
Filter: (((security)::numeric = '0'::numeric) OR (SubPlan 1))
|
SubPlan 1
|
-> Index Scan using papi_accrual_objaccount_xie4papi_accrual_objaccount on papi_accrual_objaccount oa
|
Index Cond: (((spid)::numeric = (oqp.spid)::numeric(15,0)) AND ((objectid)::numeric = (oqp.objectid)::numeric) AND ((crnid)::numeric = (ot.security)::numeric))
|
-> Index Scan using paccr_object_cprotocol_xpkpaccr_object_cprotocol on paccr_object_cprotocol dp
|
Index Cond: (((spid)::numeric = (ot.spid)::numeric) AND ((finoperid)::numeric = '222'::numeric))
|
-> Index Scan using palltemplatedoc_xie2palltemplatedoc on palltemplatedoc otd
|
Index Cond: (((spid)::numeric = (ot.spid)::numeric) AND ((opertemplateid)::numeric = (ot.opertemplateid)::numeric))
|
Filter: ((priority)::smallint = '333'::smallint)
|
-> Index Scan using pdocumenttemplate_xpkpdocumenttemplate on pdocumenttemplate pd
|
Index Cond: (((spid)::numeric = (ot.spid)::numeric) AND ((opertemplateid)::numeric = (ot.opertemplateid)::numeric))
|
(33 rows)
|
|
--zip_08859.sql
|
explain (costs off)
|
INSERT INTO pAPI_CAcc_LetterAuthority
|
(
|
SPID,
|
CurrentAccountID,
|
LetterAuthorityID,
|
Kind,
|
BranchID,
|
BranchBrief,
|
AuthorID,
|
AuthorBrief,
|
AuthorName,
|
Number,
|
DateCreation,
|
OwnerID,
|
OwnerKind,
|
OwnerBrief,
|
OwnerName,
|
OwnerICardID,
|
OwnerICardTypeBrief,
|
OwnerICardRegNumber,
|
OwnerICardRegSeries,
|
AgentID,
|
AgentBrief,
|
AgentName,
|
AgentICardID,
|
AgentICardTypeBrief,
|
AgentICardRegNumber,
|
AgentICardRegSeries,
|
DateOper,
|
DateStart,
|
TermDay,
|
TermMonth,
|
DateEnd,
|
Status,
|
Comment,
|
FinOperID,
|
StateID,
|
StateBrief,
|
StateName
|
)
|
SELECT /*+ IndexScan(r ptdpt_jr_xpkptdpt_jr)
|
IndexScan(l papi_jrel_findlist_xpkpapi_jrel_findlist)
|
IndexScan(d papi_juraldoc_findlist_xpkpapi_juraldoc_findlist)
|
IndexScan(f tdpt_finoper_sync_xpktdpt_finoper_sync)
|
IndexScan(s papi_sm_currentstate_xpkpapi_sm_currentstate)
|
IndexScan(pb tdpt_partc_sync_xpktdpt_partc_sync)
|
IndexScan(pi tdpt_partc_sync_xpktdpt_partc_sync)
|
IndexScan(pp tdpt_partc_sync_xpktdpt_partc_sync)
|
IndexScan(lp papi_prs_icard_xie1papi_prs_icard)
|
IndexScan(pc tdpt_partc_sync_xpktdpt_partc_sync)
|
IndexScan(lc papi_prs_icard_xpkpapi_prs_icard) */
|
/*! ForceOrder() */
|
777/*var__SPID_CONSTANT*/,
|
888,
|
d.JRDocID,
|
CASE WHEN coalesce(999, 0) > 0 THEN 999 ELSE CASE WHEN d.BranchID = d.AuthorID THEN 1 ELSE 2 END END,
|
d.BranchID,
|
pb.Brief,
|
d.AuthorID,
|
coalesce(pI.Brief, ''),
|
coalesce(CASE WHEN pI.PropType = 0 THEN ltrim(rtrim(concat(ltrim(rtrim(concat(ltrim(rtrim(pI.Name)), ' ', pI.Name1))), ' ', pI.Name2))) ELSE pI.Name END, ''),
|
coalesce(d.OriginalNumber, ''),
|
d.DateCreation,
|
d.OwnerID,
|
pp.PropType,
|
pp.Brief,
|
CASE WHEN pp.PropType = 0 THEN concat(ltrim(rtrim(pp.Name)), ' ', ltrim(rtrim(pp.Name1)), ' ', ltrim(rtrim(pp.Name2))) ELSE ltrim(rtrim(pp.Name)) END,
|
lp.ICardID,
|
coalesce(lp.DocType, ''),
|
coalesce(lp.RegNumber, ''),
|
coalesce(lp.RegSeries, ''),
|
d.AgentID,
|
pc.Brief,
|
CASE WHEN pc.PropType = 0 THEN concat(ltrim(rtrim(pc.Name)), ' ', ltrim(rtrim(pc.Name1)), ' ', ltrim(rtrim(pc.Name2))) ELSE ltrim(rtrim(pc.Name)) END,
|
d.AgentICardID,
|
coalesce(lc.DocType, ''),
|
coalesce(lc.RegNumber, ''),
|
coalesce(lc.RegSeries, ''),
|
d.DateOper,
|
d.DateAccount,
|
d.PeriodDay,
|
d.PeriodMonth,
|
d.DateClose,
|
CASE WHEN lower(l.Status)::DSBRIEFNAME = 'inactive' THEN 0 WHEN lower(l.Status)::DSBRIEFNAME = 'active' THEN 1 WHEN lower(l.Status)::DSBRIEFNAME = 'closed' THEN 2 WHEN lower(l.Status)::DSBRIEFNAME = 'cancelled' THEN 3 ELSE 0 END,
|
d.Comment,
|
f.FinOperID,
|
s.StateID,
|
s.Brief,
|
s.Name
|
FROM pTDpt_JR r
|
INNER JOIN pAPI_JRel_FindList l
|
ON l.SPID = 123/*var__SPID_CONSTANT*/ AND l.JRelID = r.JRelID
|
INNER JOIN pAPI_JuralDoc_FindList d
|
ON d.SPID = 777/*var__SPID_CONSTANT*/ AND d.JRDocID = l.JRDocID
|
INNER JOIN tDPT_FinOper_Sync f
|
ON f.FinOperID = d.FinOperID
|
INNER JOIN pAPI_SM_CurrentState s
|
ON s.SPID = 777/*var__SPID_CONSTANT*/ AND s.ID = r.JRelID
|
LEFT OUTER JOIN tDPT_Partc_Sync pb
|
ON pb.ParticipantID = d.BranchID
|
LEFT OUTER JOIN tDPT_Partc_Sync pi
|
ON pi.ParticipantID = d.AuthorID
|
LEFT OUTER JOIN tDPT_Partc_Sync pp
|
ON pp.ParticipantID = d.OwnerID
|
LEFT OUTER JOIN pAPI_Prs_ICard lp
|
ON lp.SPID = 777/*var__SPID_CONSTANT*/ AND lp.PersonID = d.OwnerID AND lp.FlMain = 1 AND lp.FlDead = 0
|
LEFT OUTER JOIN tDPT_Partc_Sync pc
|
ON pc.ParticipantID = d.AgentID
|
LEFT OUTER JOIN pAPI_Prs_ICard lc
|
ON lc.SPID = 777/*var__SPID_CONSTANT*/ AND lc.ICardID = d.AgentICardID AND lc.PersonID = d.AgentID
|
WHERE r.SPID = 777/*var__SPID_CONSTANT*/ AND (((111 IN (0, d.FinOperID)) AND (1 = 1)) OR ((1 = 1) AND (d.FinOperID IN (333, 444))))
|
UNION ALL
|
SELECT /*+ IndexScan(r ptdpt_jr_xpkptdpt_jr)
|
IndexScan(l tdptlegalclientlink_xpktdptlegalclientlink)
|
IndexScan(d papi_juraldoc_findlist_xpkpapi_juraldoc_findlist)
|
IndexScan(f tdpt_finoper_sync_xpktdpt_finoper_sync)
|
IndexScan(pb tdpt_partc_sync_xpktdpt_partc_sync)
|
IndexScan(s papi_sm_currentstate_xpkpapi_sm_currentstate)
|
IndexScan(pi tdpt_partc_sync_xpktdpt_partc_sync)
|
IndexScan(pp tdpt_partc_sync_xpktdpt_partc_sync)
|
IndexScan(lp papi_prs_icard_xie1papi_prs_icard)
|
IndexScan(pc tdpt_partc_sync_xpktdpt_partc_sync)
|
IndexScan(lc papi_prs_icard_xpkpapi_prs_icard) */
|
/*! ForceOrder() */
|
777/*var__SPID_CONSTANT*/,
|
555,
|
d.JRDocID,
|
CASE WHEN coalesce(999, 0) > 0 THEN 999 ELSE CASE WHEN d.BranchID = d.AuthorID THEN 1 ELSE 2 END END,
|
d.BranchID,
|
pb.Brief,
|
d.AuthorID,
|
coalesce(pI.Brief, ''),
|
coalesce(CASE WHEN pI.PropType = 0 THEN ltrim(rtrim(concat(ltrim(rtrim(concat(ltrim(rtrim(pI.Name)), ' ', pI.Name1))), ' ', pI.Name2))) ELSE pI.Name END, ''),
|
coalesce(d.OriginalNumber, ''),
|
d.DateCreation,
|
d.OwnerID,
|
pp.PropType,
|
pp.Brief,
|
CASE WHEN pp.PropType = 0 THEN concat(ltrim(rtrim(pp.Name)), ' ', ltrim(rtrim(pp.Name1)), ' ', ltrim(rtrim(pp.Name2))) ELSE ltrim(rtrim(pp.Name)) END,
|
coalesce(lp.ICardID, 0),
|
coalesce(lp.DocType, ''),
|
coalesce(lp.RegNumber, ''),
|
coalesce(lp.RegSeries, ''),
|
d.AgentID,
|
pc.Brief,
|
CASE WHEN pc.PropType = 0 THEN concat(ltrim(rtrim(pc.Name)), ' ', ltrim(rtrim(pc.Name1)), ' ', ltrim(rtrim(pc.Name2))) ELSE ltrim(rtrim(pc.Name)) END,
|
d.AgentICardID,
|
coalesce(lc.DocType, ''),
|
coalesce(lc.RegNumber, ''),
|
coalesce(lc.RegSeries, ''),
|
d.DateOper,
|
d.DateAccount,
|
777::bigint,
|
d.PeriodMonth,
|
d.DateClose,
|
CASE WHEN l.Status = 2 THEN 1 WHEN l.Status = 3 THEN 2 WHEN l.Status = 4 THEN 3 ELSE 0 END,
|
d.Comment,
|
f.FinOperID,
|
s.StateID,
|
s.Brief,
|
s.Name
|
FROM pTDpt_JR r
|
INNER JOIN tDPTLegalClientLink l
|
ON l.DPTLegalClientLinkID = r.JRelID
|
INNER JOIN pAPI_JuralDoc_FindList d
|
ON d.SPID = 777/*var__SPID_CONSTANT*/ AND d.JRDocID = l.LegalBaseID
|
INNER JOIN tDPT_FinOper_Sync f
|
ON f.FinOperID = d.FinOperID
|
INNER JOIN tDPT_Partc_Sync pb
|
ON pb.ParticipantID = d.BranchID
|
INNER JOIN pAPI_SM_CurrentState s
|
ON s.SPID = 777/*var__SPID_CONSTANT*/ AND s.ID = r.JRelID
|
LEFT OUTER JOIN tDPT_Partc_Sync pi
|
ON pi.ParticipantID = d.AuthorID
|
LEFT OUTER JOIN tDPT_Partc_Sync pp
|
ON pp.ParticipantID = d.OwnerID
|
LEFT OUTER JOIN pAPI_Prs_ICard lp
|
ON lp.SPID = 777/*var__SPID_CONSTANT*/ AND lp.PersonID = d.OwnerID AND lp.FlMain = 1 AND lp.FlDead = 0
|
LEFT OUTER JOIN tDPT_Partc_Sync pc
|
ON pc.ParticipantID = d.AgentID
|
LEFT OUTER JOIN pAPI_Prs_ICard lc
|
ON lc.SPID = 777/*var__SPID_CONSTANT*/ AND lc.ICardID = d.AgentICardID AND lc.PersonID = d.AgentID
|
WHERE r.SPID = 777/*var__SPID_CONSTANT*/ AND (((111 IN (0, d.FinOperID)) ) OR ((1 = 1) AND (d.FinOperID IN (333, 444))))
|
;
|
QUERY PLAN
|
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Insert on papi_cacc_letterauthority
|
-> Subquery Scan on "*SELECT*"
|
-> Append
|
-> Subquery Scan on "*SELECT* 1"
|
-> Nested Loop Left Join
|
Join Filter: (((lc.icardid)::numeric = (d.agenticardid)::numeric) AND ((lc.personid)::numeric = (d.agentid)::numeric))
|
-> Nested Loop Left Join
|
-> Nested Loop Left Join
|
Join Filter: ((lp.personid)::numeric = (d.ownerid)::numeric)
|
-> Nested Loop Left Join
|
-> Nested Loop Left Join
|
-> Nested Loop Left Join
|
-> Nested Loop
|
Join Filter: ((l.jrelid)::numeric = (s.id)::numeric)
|
-> Nested Loop
|
-> Nested Loop
|
Join Filter: ((l.jrdocid)::numeric = (d.jrdocid)::numeric)
|
-> Nested Loop
|
-> Index Scan using ptdpt_jr_xpkptdpt_jr on ptdpt_jr r
|
Index Cond: ((spid)::numeric = '777'::numeric)
|
-> Index Scan using papi_jrel_findlist_xpkpapi_jrel_findlist on papi_jrel_findlist l
|
Index Cond: (((spid)::numeric = '123'::numeric) AND ((jrelid)::numeric = (r.jrelid)::numeric))
|
-> Index Scan using papi_juraldoc_findlist_xpkpapi_juraldoc_findlist on papi_juraldoc_findlist d
|
Index Cond: ((spid)::numeric = '777'::numeric)
|
Filter: (('111'::numeric = (finoperid)::numeric) OR ((finoperid)::numeric = ANY ('{333,444}'::numeric[])))
|
-> Index Scan using tdpt_finoper_sync_xpktdpt_finoper_sync on tdpt_finoper_sync f
|
Index Cond: ((finoperid)::numeric = (d.finoperid)::numeric)
|
-> Index Scan using papi_sm_currentstate_xpkpapi_sm_currentstate on papi_sm_currentstate s
|
Index Cond: (((spid)::numeric = '777'::numeric) AND ((id)::numeric = (r.jrelid)::numeric))
|
-> Index Scan using tdpt_partc_sync_xpktdpt_partc_sync on tdpt_partc_sync pb
|
Index Cond: ((participantid)::numeric = (d.branchid)::numeric)
|
-> Index Scan using tdpt_partc_sync_xpktdpt_partc_sync on tdpt_partc_sync pi
|
Index Cond: ((participantid)::numeric = (d.authorid)::numeric)
|
-> Index Scan using tdpt_partc_sync_xpktdpt_partc_sync on tdpt_partc_sync pp
|
Index Cond: ((participantid)::numeric = (d.ownerid)::numeric)
|
-> Index Scan using papi_prs_icard_xie1papi_prs_icard on papi_prs_icard lp
|
Index Cond: ((spid)::numeric = '777'::numeric)
|
Filter: (((flmain)::smallint = 1) AND ((fldead)::smallint = 0))
|
-> Index Scan using tdpt_partc_sync_xpktdpt_partc_sync on tdpt_partc_sync pc
|
Index Cond: ((participantid)::numeric = (d.agentid)::numeric)
|
-> Index Scan using papi_prs_icard_xpkpapi_prs_icard on papi_prs_icard lc
|
Index Cond: ((spid)::numeric = '777'::numeric)
|
-> Nested Loop Left Join
|
Join Filter: (((lc_1.icardid)::numeric = (d_1.agenticardid)::numeric) AND ((lc_1.personid)::numeric = (d_1.agentid)::numeric))
|
-> Nested Loop Left Join
|
-> Nested Loop Left Join
|
Join Filter: ((lp_1.personid)::numeric = (d_1.ownerid)::numeric)
|
-> Nested Loop Left Join
|
-> Nested Loop Left Join
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Index Scan using ptdpt_jr_xpkptdpt_jr on ptdpt_jr r_1
|
Index Cond: ((spid)::numeric = '777'::numeric)
|
-> Index Scan using tdptlegalclientlink_xpktdptlegalclientlink on tdptlegalclientlink l_1
|
Index Cond: ((dptlegalclientlinkid)::numeric = (r_1.jrelid)::numeric)
|
-> Index Scan using papi_juraldoc_findlist_xpkpapi_juraldoc_findlist on papi_juraldoc_findlist d_1
|
Index Cond: (((spid)::numeric = '777'::numeric) AND ((jrdocid)::numeric = (l_1.legalbaseid)::numeric))
|
Filter: (('111'::numeric = (finoperid)::numeric) OR ((finoperid)::numeric = ANY ('{333,444}'::numeric[])))
|
-> Index Scan using tdpt_finoper_sync_xpktdpt_finoper_sync on tdpt_finoper_sync f_1
|
Index Cond: ((finoperid)::numeric = (d_1.finoperid)::numeric)
|
-> Index Scan using tdpt_partc_sync_xpktdpt_partc_sync on tdpt_partc_sync pb_1
|
Index Cond: ((participantid)::numeric = (d_1.branchid)::numeric)
|
-> Index Scan using papi_sm_currentstate_xpkpapi_sm_currentstate on papi_sm_currentstate s_1
|
Index Cond: (((spid)::numeric = '777'::numeric) AND ((id)::numeric = (l_1.dptlegalclientlinkid)::numeric))
|
-> Index Scan using tdpt_partc_sync_xpktdpt_partc_sync on tdpt_partc_sync pi_1
|
Index Cond: ((participantid)::numeric = (d_1.authorid)::numeric)
|
-> Index Scan using tdpt_partc_sync_xpktdpt_partc_sync on tdpt_partc_sync pp_1
|
Index Cond: ((participantid)::numeric = (d_1.ownerid)::numeric)
|
-> Index Scan using papi_prs_icard_xie1papi_prs_icard on papi_prs_icard lp_1
|
Index Cond: ((spid)::numeric = '777'::numeric)
|
Filter: (((flmain)::smallint = 1) AND ((fldead)::smallint = 0))
|
-> Index Scan using tdpt_partc_sync_xpktdpt_partc_sync on tdpt_partc_sync pc_1
|
Index Cond: ((participantid)::numeric = (d_1.agentid)::numeric)
|
-> Index Scan using papi_prs_icard_xpkpapi_prs_icard on papi_prs_icard lc_1
|
Index Cond: ((spid)::numeric = '777'::numeric)
|
(78 rows)
|
|
--zip_12633.sql
|
explain (costs off)
|
INSERT INTO pAPI_ChAcc_FndLstIDChange
|
(
|
SPID,
|
ChartAccID,
|
ChangeKind,
|
ChangeDate
|
)
|
SELECT /*+ IndexScan(aa taudit_xie4taudit)
|
IndexScan(r tresource_xpktresource) */
|
/*! ForceOrder() */
|
999,
|
r.ResourceID,
|
CASE WHEN aa.Action = 1 THEN 1 WHEN aa.Action = 2 THEN 3 ELSE 2 END,
|
aa.InDateTime
|
FROM tAudit aa
|
INNER JOIN tResource r
|
ON r.ResourceID = aa.ObjectID AND r.ResourceType = 0
|
WHERE aa.InDateTime BETWEEN '20000101' AND '20010101' AND lower(aa.ObjectName)::DSFIELDNAMEVAR = 'tresource' AND aa.Action IN (1, 2)
|
UNION
|
SELECT /*+ IndexScan(aa taudit_xie4taudit)
|
IndexScan(r hresource_xpkhresource) */
|
/*! ForceOrder() */
|
999,
|
r.ResourceID,
|
CASE WHEN aa.Action = 1 THEN 1 WHEN aa.Action = 2 THEN 3 ELSE 2 END,
|
aa.InDateTime
|
FROM tAudit aa
|
INNER JOIN hResource r
|
ON r.HistoryHeaderID = aa.AuditID AND r.ResourceType = 0
|
WHERE aa.InDateTime BETWEEN '20000101' AND '20010101' AND lower(aa.ObjectName)::DSFIELDNAMEVAR = 'tresource' AND aa.Action IN (1, 2)
|
UNION
|
SELECT /*+ IndexScan(aa taudit_xie4taudit)
|
IndexScan(r hresource_xpkhresource) */
|
/*! ForceOrder() */
|
999,
|
aa.ObjectID,
|
4,
|
aa.InDateTime
|
FROM tAudit aa
|
INNER JOIN hResource r
|
ON r.HistoryHeaderID = aa.AuditID AND r.ResourceType = 0
|
WHERE aa.InDateTime BETWEEN '20000101' AND '20010101' AND lower(aa.ObjectName)::DSFIELDNAMEVAR = 'tresource' AND aa.Action = 3
|
;
|
QUERY PLAN
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Insert on papi_chacc_fndlstidchange
|
-> Subquery Scan on "*SELECT*"
|
-> HashAggregate
|
Group Key: (999), r.resourceid, (CASE WHEN ((aa.action)::smallint = 1) THEN 1 WHEN ((aa.action)::smallint = 2) THEN 3 ELSE 2 END), aa.indatetime
|
-> Append
|
-> Nested Loop
|
-> Index Scan using taudit_xie4taudit on taudit aa
|
Index Cond: (((indatetime)::timestamp without time zone >= 'Sat Jan 01 00:00:00 2000'::timestamp without time zone) AND ((indatetime)::timestamp without time zone <= 'Mon Jan 01 00:00:00 2001'::timestamp without time zone))
|
Filter: (((action)::smallint = ANY ('{1,2}'::integer[])) AND ((lower((objectname)::text))::text = 'tresource'::text))
|
-> Index Scan using tresource_xpktresource on tresource r
|
Index Cond: ((resourceid)::numeric = (aa.objectid)::numeric)
|
Filter: ((resourcetype)::smallint = 0)
|
-> Nested Loop
|
-> Index Scan using taudit_xie4taudit on taudit aa_1
|
Index Cond: (((indatetime)::timestamp without time zone >= 'Sat Jan 01 00:00:00 2000'::timestamp without time zone) AND ((indatetime)::timestamp without time zone <= 'Mon Jan 01 00:00:00 2001'::timestamp without time zone))
|
Filter: (((action)::smallint = ANY ('{1,2}'::integer[])) AND ((lower((objectname)::text))::text = 'tresource'::text))
|
-> Index Scan using hresource_xpkhresource on hresource r_1
|
Index Cond: ((historyheaderid)::numeric = (aa_1.auditid)::numeric)
|
Filter: ((resourcetype)::smallint = 0)
|
-> Nested Loop
|
-> Index Scan using taudit_xie4taudit on taudit aa_2
|
Index Cond: (((indatetime)::timestamp without time zone >= 'Sat Jan 01 00:00:00 2000'::timestamp without time zone) AND ((indatetime)::timestamp without time zone <= 'Mon Jan 01 00:00:00 2001'::timestamp without time zone))
|
Filter: (((action)::smallint = 3) AND ((lower((objectname)::text))::text = 'tresource'::text))
|
-> Index Scan using hresource_xpkhresource on hresource r_2
|
Index Cond: ((historyheaderid)::numeric = (aa_2.auditid)::numeric)
|
Filter: ((resourcetype)::smallint = 0)
|
(26 rows)
|
|
--zip_35843.sql
|
explain (costs off)
|
UPDATE /*+ IndexScan(tpoolstorerest tpoolstorerest_xpktpoolstorerest) */
|
tPoolStoreRest
|
SET Flag = Flag & -2
|
,DocDealProtID = 0
|
WHERE PoolStoreRestID IN ( SELECT /*+ IndexScan(tpoolstorerest tpoolstorerest_xie3tpoolstorerest) */
|
PoolStoreRestID
|
FROM tPoolStoreRest
|
WHERE DocDealProtID = 777)
|
;
|
QUERY PLAN
|
---------------------------------------------------------------------------------------------------------
|
Update on tpoolstorerest
|
-> Nested Loop
|
-> HashAggregate
|
Group Key: (tpoolstorerest_1.poolstorerestid)::numeric
|
-> Index Scan using tpoolstorerest_xie3tpoolstorerest on tpoolstorerest tpoolstorerest_1
|
Index Cond: ((docdealprotid)::numeric = '777'::numeric)
|
-> Index Scan using tpoolstorerest_xpktpoolstorerest on tpoolstorerest
|
Index Cond: ((poolstorerestid)::numeric = (tpoolstorerest_1.poolstorerestid)::numeric)
|
(8 rows)
|
|
--zip_05675.sql
|
explain (costs off)
|
INSERT INTO pAPI_SM_FindParamProtocol
|
(
|
SPID,
|
ObjectID,
|
ProtocolID,
|
StateOrder,
|
ActionID,
|
ActionBrief,
|
ActionName,
|
ActionType,
|
Date,
|
AuditID,
|
Incomplete,
|
StateID
|
)
|
SELECT /*+ IndexScan(o padm_sm_paramobject_xak1padm_sm_paramobject)
|
IndexScan(p tprotocol_xak1tprotocol)
|
IndexScan(t ttransition_xpkttransition)
|
IndexScan(n1 tnode_xpktnode)
|
IndexScan(na1 tnodeattr_xpktnodeattr)
|
IndexScan(s tprotocolsuspend_xpktprotocolsuspend) */
|
/*! ForceOrder() */
|
777/*var__SPID_CONSTANT*/,
|
o.ID,
|
p.ProtocolID,
|
p.StateOrder,
|
coalesce(n1.NodeID, 0),
|
coalesce(n1.Brief, ''),
|
coalesce(n1.Name, ''),
|
coalesce(na1.PropVal, 0),
|
p.Date,
|
p.AuditID,
|
CASE WHEN coalesce(s.ProtocolID, 0) = 0 THEN 0 ELSE 1 END,
|
t.TargetStateID
|
FROM pADM_SM_ParamObject o
|
INNER JOIN tProtocol p
|
ON p.ObjectID = o.ObjectID AND p.Date BETWEEN o.DateStart AND o.DateEnd
|
INNER JOIN tTransition t
|
ON t.TransitionID = p.TransitionID
|
INNER JOIN tNode n1
|
ON n1.NodeID = t.TargetStateID
|
LEFT OUTER JOIN tNodeAttr na1
|
ON na1.NodeID = n1.NodeID
|
LEFT OUTER JOIN tProtocolSuspend s
|
ON s.ProtocolID = p.ProtocolID
|
WHERE o.SPID = 776/*var__SPID_CONSTANT*/ AND o.IsPFO = 0 AND o.AutoID BETWEEN 111 AND 222 AND (
|
EXISTS( SELECT /*+ IndexScan(poa papi_sm_paramobjectaction_xpkpapi_sm_paramobjectaction) */
|
1
|
FROM pAPI_SM_ParamObjectAction poa
|
WHERE poa.spid = 777/*var__SPID_CONSTANT*/ AND poa.ActionID = n1.NodeID AND poa.ActionType = -1) OR
|
EXISTS( SELECT /*+ IndexScan(poa papi_sm_paramobjectaction_xak1papi_sm_paramobjectaction) */
|
1
|
FROM pAPI_SM_ParamObjectAction poa
|
WHERE poa.spid = 778/*var__SPID_CONSTANT*/ AND poa.ActionID = -1 AND poa.ActionType = na1.PropVal) OR
|
EXISTS( SELECT /*+ IndexScan(poa papi_sm_paramobjectaction_xpkpapi_sm_paramobjectaction) */
|
1
|
FROM pAPI_SM_ParamObjectAction poa
|
WHERE poa.spid = 779/*var__SPID_CONSTANT*/ AND poa.ActionID = n1.NodeID AND poa.ActionType = na1.PropVal))
|
;
|
QUERY PLAN
|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Insert on papi_sm_findparamprotocol
|
-> Nested Loop Left Join
|
-> Nested Loop Left Join
|
Filter: ((hashed SubPlan 2) OR (hashed SubPlan 4) OR (SubPlan 5))
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Index Scan using padm_sm_paramobject_xak1padm_sm_paramobject on padm_sm_paramobject o
|
Index Cond: (((spid)::numeric = '776'::numeric) AND ((ispfo)::smallint = 0) AND ((autoid)::numeric >= '111'::numeric) AND ((autoid)::numeric <= '222'::numeric))
|
-> Index Scan using tprotocol_xak1tprotocol on tprotocol p
|
Index Cond: ((objectid)::numeric = (o.objectid)::numeric)
|
Filter: (((date)::timestamp without time zone >= (o.datestart)::timestamp without time zone) AND ((date)::timestamp without time zone <= (o.dateend)::timestamp without time zone))
|
-> Index Scan using ttransition_xpkttransition on ttransition t
|
Index Cond: ((transitionid)::numeric = (p.transitionid)::numeric)
|
-> Index Scan using tnode_xpktnode on tnode n1
|
Index Cond: ((nodeid)::numeric = (t.targetstateid)::numeric)
|
-> Index Scan using tnodeattr_xpktnodeattr on tnodeattr na1
|
Index Cond: ((nodeid)::numeric = (n1.nodeid)::numeric)
|
SubPlan 2
|
-> Index Scan using papi_sm_paramobjectaction_xpkpapi_sm_paramobjectaction on papi_sm_paramobjectaction poa
|
Index Cond: (((spid)::numeric = '777'::numeric) AND ((actiontype)::integer = '-1'::integer))
|
SubPlan 4
|
-> Index Scan using papi_sm_paramobjectaction_xak1papi_sm_paramobjectaction on papi_sm_paramobjectaction poa_1
|
Index Cond: (((spid)::numeric = '778'::numeric) AND ((actionid)::numeric = '-1'::numeric))
|
SubPlan 5
|
-> Index Scan using papi_sm_paramobjectaction_xpkpapi_sm_paramobjectaction on papi_sm_paramobjectaction poa_2
|
Index Cond: (((spid)::numeric = '779'::numeric) AND ((actionid)::numeric = (n1.nodeid)::numeric) AND ((actiontype)::integer = (na1.propval)::integer))
|
-> Index Scan using tprotocolsuspend_xpktprotocolsuspend on tprotocolsuspend s
|
Index Cond: ((protocolid)::numeric = (p.protocolid)::numeric)
|
(29 rows)
|
|
--06446.sql
|
explain (costs off)
|
SELECT /*+ IndexScan(lb tlegalbase_xie1tlegalbase)
|
IndexScan(o tobject_xak2tobject)
|
IndexScan(p tprotocol_xpktprotocol)
|
IndexScan(t ttransition_xpkttransition)
|
IndexScan(n tnode_xpktnode) */
|
/*! ForceOrder() */
|
lb.LegalBaseID,
|
lb.InstrumentID,
|
lb.BranchID
|
FROM tLegalBase lb, tObject o, tProtocol p, tTransition t, tNode n
|
WHERE lb.InstParentID = 123 AND o.InstrumentID = lb.InstrumentID AND o.ID = lb.LegalBaseID AND p.ProtocolID = o.CurrProtocolID AND t.TransitionID = p.TransitionID AND n.NodeID = t.TargetStateID AND n.StateType <> 16
|
UNION
|
SELECT /*+ IndexScan(lb tlegalbase_xie3tlegalbase)
|
IndexScan(o tobject_xak2tobject)
|
IndexScan(p tprotocol_xpktprotocol)
|
IndexScan(t ttransition_xpkttransition)
|
IndexScan(n tnode_xpktnode) */
|
/*! ForceOrder() */
|
lb.LegalBaseID,
|
lb.InstrumentID,
|
lb.BranchID
|
FROM tLegalBase lb, tObject o, tProtocol p, tTransition t, tNode n
|
WHERE lb.InstChildID = 123 AND o.InstrumentID = lb.InstrumentID AND o.ID = lb.LegalBaseID AND p.ProtocolID = o.CurrProtocolID AND t.TransitionID = p.TransitionID AND n.NodeID = t.TargetStateID AND n.StateType <> 16
|
;
|
QUERY PLAN
|
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Unique
|
-> Sort
|
Sort Key: lb.legalbaseid, lb.instrumentid, lb.branchid
|
-> Append
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Index Scan using tlegalbase_xie1tlegalbase on tlegalbase lb
|
Index Cond: ((instparentid)::numeric = '123'::numeric)
|
-> Index Scan using tobject_xak2tobject on tobject o
|
Index Cond: (((instrumentid)::numeric = (lb.instrumentid)::numeric) AND ((id)::numeric = (lb.legalbaseid)::numeric))
|
-> Index Scan using tprotocol_xpktprotocol on tprotocol p
|
Index Cond: ((protocolid)::numeric = (o.currprotocolid)::numeric)
|
-> Index Scan using ttransition_xpkttransition on ttransition t
|
Index Cond: ((transitionid)::numeric = (p.transitionid)::numeric)
|
-> Index Scan using tnode_xpktnode on tnode n
|
Index Cond: ((nodeid)::numeric = (t.targetstateid)::numeric)
|
Filter: ((statetype)::numeric <> '16'::numeric)
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Nested Loop
|
-> Index Scan using tlegalbase_xie3tlegalbase on tlegalbase lb_1
|
Index Cond: ((instchildid)::numeric = '123'::numeric)
|
-> Index Scan using tobject_xak2tobject on tobject o_1
|
Index Cond: (((instrumentid)::numeric = (lb_1.instrumentid)::numeric) AND ((id)::numeric = (lb_1.legalbaseid)::numeric))
|
-> Index Scan using tprotocol_xpktprotocol on tprotocol p_1
|
Index Cond: ((protocolid)::numeric = (o_1.currprotocolid)::numeric)
|
-> Index Scan using ttransition_xpkttransition on ttransition t_1
|
Index Cond: ((transitionid)::numeric = (p_1.transitionid)::numeric)
|
-> Index Scan using tnode_xpktnode on tnode n_1
|
Index Cond: ((nodeid)::numeric = (t_1.targetstateid)::numeric)
|
Filter: ((statetype)::numeric <> '16'::numeric)
|
(34 rows)
|
|
--06547.sql
|
explain (costs off)
|
INSERT INTO pAPI_Lawsuit_Notification
|
(
|
spid,
|
LawsuitID,
|
NTFID,
|
NTFMessage
|
)
|
SELECT /*+ IndexScan(p papi_lawsuit_massupdate_xpkpapi_lawsuit_massupdate) */
|
spid,
|
LawsuitID,
|
500146,
|
'aaa'
|
FROM pAPI_Lawsuit_MassUpdate p
|
WHERE p.spid = 999 AND (p.BranchBrief <> '' OR p.BranchID <> 0) AND NOT EXISTS( SELECT /*+ IndexScan(n papi_lawsuit_notification_xpkpapi_lawsuit_notification) */
|
1
|
FROM pAPI_Lawsuit_Notification n
|
WHERE n.spid = 999 AND n.LawsuitID = p.LawsuitID) AND NOT EXISTS( SELECT /*+ IndexScan(i tinstitution_xpktinstitution) */
|
1
|
FROM tInstitution i
|
WHERE i.InstitutionID = p.BranchID AND i.InstType IN (1, 2, 3)) AND NOT EXISTS( SELECT /*+ IndexScan(i tinstitution_xak2tinstitution) */
|
1
|
FROM tInstitution i
|
WHERE lower(i.Brief)::DSACCNUMBER = lower(p.BranchBrief)::DSACCNUMBER AND i.PropDealPart = 1 AND i.InstType IN (1, 2, 3))
|
;
|
QUERY PLAN
|
--------------------------------------------------------------------------------------------------------------------------------
|
Insert on papi_lawsuit_notification
|
-> Nested Loop Anti Join
|
Join Filter: ((lower((i_1.brief)::text))::bpchar = (lower((p.branchbrief)::text))::bpchar)
|
-> Nested Loop Anti Join
|
-> Nested Loop Anti Join
|
-> Index Scan using papi_lawsuit_massupdate_xpkpapi_lawsuit_massupdate on papi_lawsuit_massupdate p
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
Filter: (((branchbrief)::bpchar <> ''::bpchar) OR ((branchid)::numeric <> '0'::numeric))
|
-> Index Scan using papi_lawsuit_notification_xpkpapi_lawsuit_notification on papi_lawsuit_notification n
|
Index Cond: (((spid)::numeric = '999'::numeric) AND ((lawsuitid)::numeric = (p.lawsuitid)::numeric))
|
-> Index Scan using tinstitution_xpktinstitution on tinstitution i
|
Index Cond: ((institutionid)::numeric = (p.branchid)::numeric)
|
Filter: ((insttype)::smallint = ANY ('{1,2,3}'::integer[]))
|
-> Index Scan using tinstitution_xak2tinstitution on tinstitution i_1
|
Index Cond: ((propdealpart)::smallint = 1)
|
Filter: ((insttype)::smallint = ANY ('{1,2,3}'::integer[]))
|
(16 rows)
|
|
--11623.sql
|
explain (costs off)
|
INSERT INTO pGNA_FindListByParam
|
(
|
SPID,
|
LinkID,
|
TypeAccLinkID,
|
CntTypeAccLink,
|
LinkCrnID,
|
ResidentFlag
|
)
|
SELECT /*+ IndexScan(p papi_gna_param_xpkpapi_gna_param)
|
IndexScan(i tinstitution_xpktinstitution)
|
IndexScan(ir papi_finoper_findlst_xpkpapi_finoper_findlst)
|
IndexScan(ta ttypeacclink_xie3ttypeacclink)
|
IndexScan(l tlinkedacctype_xpktlinkedacctype) */
|
/*! ForceOrder() */
|
999,
|
p.LinkID,
|
ta.TypeAccLinkID,
|
1,
|
p.LinkCrnID,
|
ta.IsResident
|
FROM pAPI_GNA_Param p
|
INNER JOIN tInstitution i
|
ON i.InstitutionID = p.BranchID
|
INNER JOIN pAPI_FinOper_FindLst ir
|
ON ir.SPID = 999 AND ir.FinOperID = p.RelTypeID AND ir.InterfaceObjectID <> 137
|
INNER JOIN tTypeAccLink ta
|
ON ta.RelType = p.RelType AND ta.LinkType = 1 AND ta.ObjectID = p.RelTypeID
|
INNER JOIN tLinkedAccType l
|
ON l.LinkedAccTypeID = ta.AccType
|
WHERE p.SPID = 999 AND 1 = 1 AND NOT EXISTS( SELECT /*+ IndexScan(e papi_gna_fndlstbyparamntf_xpkpapi_gna_fndlstbyparamntf) */
|
1
|
FROM pAPI_GNA_FndLstByParamNtf e
|
WHERE e.SPID = 999 AND e.LinkID = p.LinkID) AND NOT EXISTS( SELECT /*+ IndexScan(e pgna_findlistbyparam_xpkpgna_findlistbyparam) */
|
1
|
FROM pGNA_FindListByParam e
|
WHERE e.SPID = 999 AND e.LinkID = p.LinkID) AND p.TypeID IN (0, ta.AccType) AND p.SysTypeID IN (0, l.PropVal) AND (444 = 1 OR (ta.DateFrom <= p.Date AND (ta.DateTo = CAST('19000101' AS TIMESTAMP) OR ta.DateTo >= p.Date))) AND (ta.BranchID = p.BranchID OR ta.BranchID = i.ParentID AND NOT EXISTS( SELECT /*+ IndexScan(ta ttypeacclink_xie3ttypeacclink)
|
IndexScan(fo papi_finoper_findlst_xpkpapi_finoper_findlst)
|
IndexScan(l tlinkedacctype_xpktlinkedacctype) */
|
1
|
FROM tTypeAccLink ta
|
INNER JOIN pAPI_FinOper_FindLst fo
|
ON fo.SPID = 999 AND fo.FinOperID = ta.ObjectID AND fo.InterfaceObjectID <> 137
|
INNER JOIN tLinkedAccType l
|
ON l.LinkedAccTypeID = ta.AccType
|
WHERE ta.RelType = p.RelType AND ta.LinkType = 1 AND ta.ObjectID = p.RelTypeID AND p.TypeID IN (0, ta.AccType) AND p.SysTypeID IN (0, l.PropVal) AND (444 = 1 OR (ta.DateFrom <= p.Date AND (ta.DateTo = CAST('19000101' AS TIMESTAMP) OR ta.DateTo >= p.Date))) AND ta.BranchID = p.BranchID) OR ta.BranchID = 0 AND NOT EXISTS( SELECT /*+ IndexScan(ta ttypeacclink_xie3ttypeacclink)
|
IndexScan(fo papi_finoper_findlst_xpkpapi_finoper_findlst)
|
IndexScan(l tlinkedacctype_xpktlinkedacctype) */
|
1
|
FROM tTypeAccLink ta
|
INNER JOIN pAPI_FinOper_FindLst fo
|
ON fo.SPID = 999 AND fo.FinOperID = ta.ObjectID AND fo.InterfaceObjectID <> 137
|
INNER JOIN tLinkedAccType l
|
ON l.LinkedAccTypeID = ta.AccType
|
WHERE ta.RelType = p.RelType AND ta.LinkType = 1 AND ta.ObjectID = p.RelTypeID AND p.TypeID IN (0, ta.AccType) AND p.SysTypeID IN (0, l.PropVal) AND (444 = 1 OR (ta.DateFrom <= p.Date AND (ta.DateTo = CAST('19000101' AS TIMESTAMP) OR ta.DateTo >= p.Date))) AND (ta.BranchID = p.BranchID OR ta.BranchID = i.ParentID))) AND ta.FundID = 0 AND (p.ResidentFlag = ta.IsResident OR p.ResidentFlag = 3)
|
;
|
QUERY PLAN
|
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Insert on pgna_findlistbyparam
|
-> Nested Loop Anti Join
|
Join Filter: ((e_1.linkid)::numeric = (p.linkid)::numeric)
|
-> Nested Loop Anti Join
|
-> Nested Loop
|
Join Filter: (((p.systypeid)::numeric = '0'::numeric) OR ((p.systypeid)::numeric = (l.propval)::numeric))
|
-> Nested Loop
|
Join Filter: (((ir.finoperid)::numeric = (ta.objectid)::numeric) AND (((ta.branchid)::numeric = (p.branchid)::numeric) OR (((ta.branchid)::numeric = (i.parentid)::numeric) AND (NOT (SubPlan 1))) OR (((ta.branchid)::numeric = '0'::numeric) AND (NOT (SubPlan 2)))))
|
-> Nested Loop
|
Join Filter: ((p.reltypeid)::numeric = (ir.finoperid)::numeric)
|
-> Nested Loop
|
-> Index Scan using papi_gna_param_xpkpapi_gna_param on papi_gna_param p
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Index Scan using tinstitution_xpktinstitution on tinstitution i
|
Index Cond: ((institutionid)::numeric = (p.branchid)::numeric)
|
-> Index Scan using papi_finoper_findlst_xpkpapi_finoper_findlst on papi_finoper_findlst ir
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
Filter: ((interfaceobjectid)::numeric <> '137'::numeric)
|
-> Index Scan using ttypeacclink_xie3ttypeacclink on ttypeacclink ta
|
Index Cond: (((reltype)::numeric = (p.reltype)::numeric) AND ((linktype)::numeric = '1'::numeric) AND ((objectid)::numeric = (p.reltypeid)::numeric))
|
Filter: (((fundid)::numeric = '0'::numeric) AND ((datefrom)::timestamp without time zone <= (p.date)::timestamp without time zone) AND (((p.typeid)::numeric = '0'::numeric) OR ((p.typeid)::numeric = (acctype)::numeric)) AND (((dateto)::timestamp without time zone = 'Mon Jan 01 00:00:00 1900'::timestamp without time zone) OR ((dateto)::timestamp without time zone >= (p.date)::timestamp without time zone)) AND (((p.residentflag)::numeric = (isresident)::numeric) OR ((p.residentflag)::smallint = 3)))
|
SubPlan 1
|
-> Nested Loop
|
-> Nested Loop
|
-> Index Scan using ttypeacclink_xie3ttypeacclink on ttypeacclink ta_1
|
Index Cond: (((reltype)::numeric = (p.reltype)::numeric) AND ((linktype)::numeric = '1'::numeric) AND ((objectid)::numeric = (p.reltypeid)::numeric))
|
Filter: (((datefrom)::timestamp without time zone <= (p.date)::timestamp without time zone) AND ((branchid)::numeric = (p.branchid)::numeric) AND (((p.typeid)::numeric = '0'::numeric) OR ((p.typeid)::numeric = (acctype)::numeric)) AND (((dateto)::timestamp without time zone = 'Mon Jan 01 00:00:00 1900'::timestamp without time zone) OR ((dateto)::timestamp without time zone >= (p.date)::timestamp without time zone)))
|
-> Index Scan using papi_finoper_findlst_xpkpapi_finoper_findlst on papi_finoper_findlst fo
|
Index Cond: (((spid)::numeric = '999'::numeric) AND ((finoperid)::numeric = (p.reltypeid)::numeric))
|
Filter: ((interfaceobjectid)::numeric <> '137'::numeric)
|
-> Index Scan using tlinkedacctype_xpktlinkedacctype on tlinkedacctype l_1
|
Index Cond: ((linkedacctypeid)::numeric = (ta_1.acctype)::numeric)
|
Filter: (((p.systypeid)::numeric = '0'::numeric) OR ((p.systypeid)::numeric = (propval)::numeric))
|
SubPlan 2
|
-> Nested Loop
|
-> Nested Loop
|
-> Index Scan using ttypeacclink_xie3ttypeacclink on ttypeacclink ta_2
|
Index Cond: (((reltype)::numeric = (p.reltype)::numeric) AND ((linktype)::numeric = '1'::numeric) AND ((objectid)::numeric = (p.reltypeid)::numeric))
|
Filter: (((datefrom)::timestamp without time zone <= (p.date)::timestamp without time zone) AND (((p.typeid)::numeric = '0'::numeric) OR ((p.typeid)::numeric = (acctype)::numeric)) AND (((dateto)::timestamp without time zone = 'Mon Jan 01 00:00:00 1900'::timestamp without time zone) OR ((dateto)::timestamp without time zone >= (p.date)::timestamp without time zone)) AND (((branchid)::numeric = (p.branchid)::numeric) OR ((branchid)::numeric = (i.parentid)::numeric)))
|
-> Index Scan using papi_finoper_findlst_xpkpapi_finoper_findlst on papi_finoper_findlst fo_1
|
Index Cond: (((spid)::numeric = '999'::numeric) AND ((finoperid)::numeric = (p.reltypeid)::numeric))
|
Filter: ((interfaceobjectid)::numeric <> '137'::numeric)
|
-> Index Scan using tlinkedacctype_xpktlinkedacctype on tlinkedacctype l_2
|
Index Cond: ((linkedacctypeid)::numeric = (ta_2.acctype)::numeric)
|
Filter: (((p.systypeid)::numeric = '0'::numeric) OR ((p.systypeid)::numeric = (propval)::numeric))
|
-> Index Scan using tlinkedacctype_xpktlinkedacctype on tlinkedacctype l
|
Index Cond: ((linkedacctypeid)::numeric = (ta.acctype)::numeric)
|
-> Index Scan using papi_gna_fndlstbyparamntf_xpkpapi_gna_fndlstbyparamntf on papi_gna_fndlstbyparamntf e
|
Index Cond: (((spid)::numeric = '999'::numeric) AND ((linkid)::numeric = (p.linkid)::numeric))
|
-> Index Scan using pgna_findlistbyparam_xpkpgna_findlistbyparam on pgna_findlistbyparam e_1
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
(51 rows)
|
|
--18527.sql
|
explain (costs off)
|
INSERT INTO tDocMark
|
(
|
SPID,
|
Type,
|
ID
|
)
|
SELECT /*+ IndexScan(p papi_prmd_attriblist_xpkpapi_prmd_attriblist) */
|
/*! ForceOrder() */
|
999,
|
555,
|
p.PrmDID
|
FROM pAPI_PrmD_AttribList p
|
WHERE p.SPID = 999 AND p.Date = coalesce(p.Date) AND p.FinOperID = coalesce(p.FinOperID) AND p.DocumentType = coalesce(p.DocumentType) AND 1 = (CASE 1 WHEN 0 THEN 1 ELSE CASE WHEN (EXISTS( SELECT /*+ IndexScan(cs papi_cashorder_cashsymbol_xie1papi_cashorder_cashsymbol) */
|
1
|
FROM pAPI_CashOrder_CashSymbol cs
|
WHERE cs.spid = 999 AND cs.CashOrderID = p.PrmDID AND cs.SymbolTypeFlag = 111)) OR EXISTS( SELECT /*+ IndexScan(a tdptaccountlink_xie1tdptaccountlink) */
|
1
|
FROM tDPTAccountLink a
|
WHERE a.ObjectID = 222 AND a.Flags > 100 AND a.AccountID = (CASE 111 WHEN 1 THEN p.CreditAccountID WHEN 2 THEN p.DebitAccountID ELSE 0 END)) OR EXISTS( SELECT /*+ IndexScan(a pdpt_objectbytype_xpkpdpt_objectbytype) */
|
1
|
FROM pDPT_ObjectByType a
|
WHERE a.spid = 999 AND a.ID = p.PrmDID AND a.Type = 111) THEN 1 ELSE 0 END END)
|
;
|
QUERY PLAN
|
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Insert on tdocmark
|
InitPlan 3 (returns $2)
|
-> Index Scan using tdptaccountlink_xie1tdptaccountlink on tdptaccountlink a
|
Index Cond: ((objectid)::numeric = '222'::numeric)
|
Filter: (((flags)::integer > 100) AND ((accountid)::numeric = '0'::numeric))
|
-> Index Scan using papi_prmd_attriblist_xpkpapi_prmd_attriblist on papi_prmd_attriblist p
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
Filter: (((date)::timestamp without time zone = (COALESCE(date))::timestamp without time zone) AND ((finoperid)::numeric = (COALESCE(finoperid))::numeric) AND ((documenttype)::smallint = (COALESCE(documenttype))::smallint) AND (1 = CASE WHEN ((hashed SubPlan 2) OR $2 OR (hashed SubPlan 5)) THEN 1 ELSE 0 END))
|
SubPlan 2
|
-> Index Scan using papi_cashorder_cashsymbol_xie1papi_cashorder_cashsymbol on papi_cashorder_cashsymbol cs
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
Filter: ((symboltypeflag)::smallint = 111)
|
SubPlan 5
|
-> Index Scan using pdpt_objectbytype_xpkpdpt_objectbytype on pdpt_objectbytype a_1
|
Index Cond: (((spid)::numeric = '999'::numeric) AND ((type)::integer = 111))
|
(15 rows)
|
|
--21239.sql
|
explain (costs off)
|
INSERT INTO pAPI_RuleDoc_CsOrdSubAccount
|
(
|
SPID,
|
LinkID,
|
Number,
|
Amount,
|
Text
|
)
|
SELECT /*+ IndexScan(sub pgaapallsubcontoresource_xak1allsubcontoresource)
|
IndexScan(d tdepartment_xpktdepartment)
|
IndexScan(p pdoccas_xpkpdoccas) */
|
/*! ForceOrder() */
|
999,
|
p.DocLinkID,
|
CASE WHEN 0 = 0 AND rtrim(d.Brief) = '543' THEN CAST(d.Brief AS int) ELSE 0 END,
|
coalesce(p.CashQty1, 0),
|
d.Name
|
FROM pGAAPAllSubcontoResource sub, tDepartment d, pDocCas p
|
WHERE sub.SPID = 999 AND p.SPID = 999 AND p.DocLinkID = sub.ID AND d.DepartmentID = sub.DepID1
|
UNION ALL
|
SELECT /*+ IndexScan(sub pgaapallsubcontoresource_xak1allsubcontoresource)
|
IndexScan(d tdepartment_xpktdepartment)
|
IndexScan(p pdoccas_xpkpdoccas) */
|
/*! ForceOrder() */
|
999,
|
p.DocLinkID,
|
CASE WHEN 0 = 0 AND rtrim(d.Brief) = '765' THEN CAST(d.Brief AS int) ELSE 0 END,
|
coalesce(p.CashQty2, 0),
|
d.Name
|
FROM pGAAPAllSubcontoResource sub, tDepartment d, pDocCas p
|
WHERE sub.SPID = 999 AND p.SPID = 999 AND p.DocLinkID = sub.ID AND d.DepartmentID = sub.DepID2
|
;
|
QUERY PLAN
|
-----------------------------------------------------------------------------------------------------------------------------------------
|
Insert on papi_ruledoc_csordsubaccount
|
-> Result
|
-> Append
|
-> Subquery Scan on "*SELECT* 1"
|
-> Nested Loop
|
Join Filter: ((sub.id)::numeric = (p.doclinkid)::numeric)
|
-> Nested Loop
|
-> Index Scan using pgaapallsubcontoresource_xak1allsubcontoresource on pgaapallsubcontoresource sub
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Index Scan using tdepartment_xpktdepartment on tdepartment d
|
Index Cond: ((departmentid)::numeric = (sub.depid1)::numeric)
|
-> Index Scan using pdoccas_xpkpdoccas on pdoccas p
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Subquery Scan on "*SELECT* 2"
|
-> Nested Loop
|
Join Filter: ((sub_1.id)::numeric = (p_1.doclinkid)::numeric)
|
-> Nested Loop
|
-> Index Scan using pgaapallsubcontoresource_xak1allsubcontoresource on pgaapallsubcontoresource sub_1
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Index Scan using tdepartment_xpktdepartment on tdepartment d_1
|
Index Cond: ((departmentid)::numeric = (sub_1.depid2)::numeric)
|
-> Index Scan using pdoccas_xpkpdoccas on pdoccas p_1
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
(23 rows)
|
|
--24543.sql
|
explain (costs off)
|
DELETE /*! ForceOrder() */
|
FROM pResList
|
WHERE pResList.ctid IN ( SELECT /*+ IndexScan(t preslist_xpkpreslist)
|
IndexScan(r tresource_xpktresource)
|
IndexScan(ur tgl_userright_sync_xpktgl_userright_sync)
|
IndexScan(urf tgl_userright_sync_xpktgl_userright_sync)
|
IndexScan(urb tgl_userright_sync_xpktgl_userright_sync)
|
IndexScan(urb2 tgl_userright_sync_xpktgl_userright_sync) */
|
t.ctid
|
FROM pResList t
|
INNER JOIN tResource r
|
ON r.ResourceID = t.ResourceID
|
LEFT OUTER JOIN tGL_UserRight_Sync ur
|
ON ur.UserID = 111 AND ur.RightType = 0 AND ur.ObjectID = r.BalanceID
|
LEFT OUTER JOIN tGL_UserRight_Sync urf
|
ON urf.UserID = 111 AND urf.RightType = 1 AND urf.ObjectID = r.FundID
|
LEFT OUTER JOIN tGL_UserRight_Sync urb
|
ON urb.UserID = 111 AND urb.RightType = 9 AND urb.ObjectID = r.InstitutionID
|
LEFT OUTER JOIN tGL_UserRight_Sync urb2
|
ON urb2.UserID = 111 AND urb2.RightType = 9 AND urb2.ObjectID = r.SubDivisionID
|
WHERE t.SPID = 222 AND (ur.ObjectID IS NULL OR urf.ObjectID IS NULL OR (urb.ObjectID IS NULL OR urb2.ObjectID IS NULL) OR NOT EXISTS( SELECT /*+ IndexScan(ur2 tuserres_xpktuserres) */
|
1
|
FROM pTmp_UserPost p
|
INNER JOIN tUserRes ur2
|
ON ur2.UserID = p.PostID AND ur2.UserResType = 19 AND ur2.ResourceID = r.AccProfileID AND (ur2.AccessType & 4) > 0) OR (NOT EXISTS( SELECT /*+ IndexScan(urf2 tuserres_xpktuserres) */
|
1
|
FROM pTmp_UserPost p
|
INNER JOIN tUserRes urf2
|
ON urf2.UserID = p.PostID AND urf2.UserResType = 1 AND urf2.ResourceID = r.FundID AND (urf2.AccessType & 4) > 0) AND NOT EXISTS( SELECT /*+ IndexScan(urb2 tuserres_xpktuserres) */
|
1
|
FROM pTmp_UserPost p
|
INNER JOIN tUserRes urb2
|
ON urb2.UserID = p.PostID AND urb2.UserResType = 9 AND urb2.ResourceID = r.SubDivisionID AND (urb2.AccessType & 4) > 0) AND NOT EXISTS( SELECT /*+ IndexScan(rb tresourcebind_xak1tresourcebind)
|
IndexScan(ur tuserres_xpktuserres) */
|
1
|
FROM pTmp_UserPost p
|
INNER JOIN tResourceBind rb
|
ON rb.ChildID = r.ResourceID
|
INNER JOIN tUserRes ur
|
ON ur.UserID = p.PostID AND ur.UserResType = 10 AND ur.ResourceID = rb.ParentID AND (ur.AccessType & 4) > 0))))
|
;
|
QUERY PLAN
|
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Delete on preslist
|
-> Nested Loop
|
-> HashAggregate
|
Group Key: t.ctid
|
-> Nested Loop Left Join
|
Filter: ((ur.objectid IS NULL) OR (urf.objectid IS NULL) OR (urb.objectid IS NULL) OR (urb2.objectid IS NULL) OR (NOT (SubPlan 1)) OR ((NOT (SubPlan 2)) AND (NOT (SubPlan 3)) AND (NOT (SubPlan 4))))
|
-> Nested Loop Left Join
|
-> Nested Loop Left Join
|
-> Nested Loop Left Join
|
-> Nested Loop
|
-> Index Scan using preslist_xpkpreslist on preslist t
|
Index Cond: ((spid)::numeric = '222'::numeric)
|
-> Index Scan using tresource_xpktresource on tresource r
|
Index Cond: ((resourceid)::numeric = (t.resourceid)::numeric)
|
-> Index Scan using tgl_userright_sync_xpktgl_userright_sync on tgl_userright_sync ur
|
Index Cond: (((userid)::numeric = '111'::numeric) AND ((righttype)::numeric = '0'::numeric) AND ((objectid)::numeric = (r.balanceid)::numeric))
|
-> Index Scan using tgl_userright_sync_xpktgl_userright_sync on tgl_userright_sync urf
|
Index Cond: (((userid)::numeric = '111'::numeric) AND ((righttype)::numeric = '1'::numeric) AND ((objectid)::numeric = (r.fundid)::numeric))
|
-> Index Scan using tgl_userright_sync_xpktgl_userright_sync on tgl_userright_sync urb
|
Index Cond: (((userid)::numeric = '111'::numeric) AND ((righttype)::numeric = '9'::numeric) AND ((objectid)::numeric = (r.institutionid)::numeric))
|
-> Index Scan using tgl_userright_sync_xpktgl_userright_sync on tgl_userright_sync urb2
|
Index Cond: (((userid)::numeric = '111'::numeric) AND ((righttype)::numeric = '9'::numeric) AND ((objectid)::numeric = (r.subdivisionid)::numeric))
|
SubPlan 1
|
-> Nested Loop
|
-> Seq Scan on ptmp_userpost p
|
-> Index Scan using tuserres_xpktuserres on tuserres ur2
|
Index Cond: (((userid)::numeric = p.postid) AND ((userrestype)::numeric = '19'::numeric) AND ((resourceid)::numeric = (r.accprofileid)::numeric))
|
Filter: (((accesstype)::integer & 4) > 0)
|
SubPlan 2
|
-> Nested Loop
|
-> Seq Scan on ptmp_userpost p_1
|
-> Index Scan using tuserres_xpktuserres on tuserres urf2
|
Index Cond: (((userid)::numeric = p_1.postid) AND ((userrestype)::numeric = '1'::numeric) AND ((resourceid)::numeric = (r.fundid)::numeric))
|
Filter: (((accesstype)::integer & 4) > 0)
|
SubPlan 3
|
-> Nested Loop
|
-> Seq Scan on ptmp_userpost p_2
|
-> Index Scan using tuserres_xpktuserres on tuserres urb2_1
|
Index Cond: (((userid)::numeric = p_2.postid) AND ((userrestype)::numeric = '9'::numeric) AND ((resourceid)::numeric = (r.subdivisionid)::numeric))
|
Filter: (((accesstype)::integer & 4) > 0)
|
SubPlan 4
|
-> Nested Loop
|
Join Filter: ((rb.parentid)::numeric = (ur_1.resourceid)::numeric)
|
-> Nested Loop
|
-> Index Scan using tresourcebind_xak1tresourcebind on tresourcebind rb
|
Index Cond: ((childid)::numeric = (r.resourceid)::numeric)
|
-> Seq Scan on ptmp_userpost p_3
|
-> Index Scan using tuserres_xpktuserres on tuserres ur_1
|
Index Cond: (((userid)::numeric = p_3.postid) AND ((userrestype)::numeric = '10'::numeric))
|
Filter: (((accesstype)::integer & 4) > 0)
|
-> Tid Scan on preslist
|
TID Cond: (ctid = t.ctid)
|
(52 rows)
|
|
--32444.sql
|
explain (costs off)
|
UPDATE /*+ IndexScan(d prko_f251_docum_xpkprko_f251_docum) */
|
pRKO_f251_Docum tab__update
|
SET InStrFlags = 0
|
FROM pRKO_f251_Docum d
|
WHERE tab__update.ctid = d.ctid AND (d.SPID = 999 AND (d.InStrFlags & 524288 = 524288) AND (d.InStrFlags & 65535 <> 0) AND NOT EXISTS( SELECT /*+ IndexScan(d2 prko_f251_docum_xie2prko_f251_docum) */
|
1
|
FROM pRKO_f251_Docum d2
|
WHERE d2.SPID = 999 AND d2.InStrFlags = 524288 AND d2.DealTransactID = d.DealTransactID) AND NOT EXISTS( SELECT /*+ IndexScan(d2 prko_f251_docum_xie3prko_f251_docum) */
|
1
|
FROM pRKO_f251_Docum d2
|
WHERE d2.SPID = 999 AND d2.InStrFlags = 524288 AND d2.OperID <> 0 AND d2.OperID = d.OperID))
|
;
|
QUERY PLAN
|
----------------------------------------------------------------------------------------------------------------------------
|
Update on prko_f251_docum tab__update
|
-> Nested Loop Anti Join
|
Join Filter: ((d2_1.operid)::numeric = (d.operid)::numeric)
|
-> Nested Loop Anti Join
|
Join Filter: ((d2.dealtransactid)::numeric = (d.dealtransactid)::numeric)
|
-> Nested Loop
|
-> Index Scan using prko_f251_docum_xpkprko_f251_docum on prko_f251_docum d
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
Filter: ((((instrflags)::integer & 65535) <> 0) AND (((instrflags)::integer & 524288) = 524288))
|
-> Tid Scan on prko_f251_docum tab__update
|
TID Cond: (ctid = d.ctid)
|
-> Index Scan using prko_f251_docum_xie2prko_f251_docum on prko_f251_docum d2
|
Index Cond: (((spid)::numeric = '999'::numeric) AND ((instrflags)::integer = 524288))
|
-> Index Scan using prko_f251_docum_xie3prko_f251_docum on prko_f251_docum d2_1
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
Filter: (((operid)::numeric <> '0'::numeric) AND ((instrflags)::integer = 524288))
|
(16 rows)
|
|
--34749.sql
|
explain (costs off)
|
INSERT INTO pRKOResource
|
(
|
SPID,
|
ResourceID
|
)
|
SELECT /*+ IndexScan(p prkocomiss_docterm_xie0prkocomiss_docterm) */
|
/*! ForceOrder() */
|
999,
|
p.ResourceID
|
FROM pRKOComiss_DocTerm p
|
WHERE p.spid = 999 AND p.AccountMethodID = 0
|
GROUP BY
|
p.ResourceID
|
UNION
|
SELECT /*+ IndexScan(p prkocomiss_docterm_xie0prkocomiss_docterm)
|
IndexScan(t papi_oper_fndlstbylstacc_xie1papi_oper_fndlstbylstacc) */
|
/*! ForceOrder() */
|
999,
|
t.AccountDebitID
|
FROM pRKOComiss_DocTerm p
|
INNER JOIN pAPI_Oper_FndLstByLstAcc t
|
ON t.spid = p.spid AND t.AccountDebitID = p.ResourceID
|
WHERE p.spid = 999
|
UNION
|
SELECT /*+ IndexScan(p prkocomiss_docterm_xie0prkocomiss_docterm)
|
IndexScan(t papi_oper_fndlstbylstacc_xie1papi_oper_fndlstbylstacc) */
|
/*! ForceOrder() */
|
999,
|
t.AccountCreditID
|
FROM pRKOComiss_DocTerm p
|
INNER JOIN pAPI_Oper_FndLstByLstAcc t
|
ON t.spid = p.spid AND t.AccountDebitID = p.ResourceID
|
WHERE p.spid = 999
|
UNION
|
SELECT /*+ IndexScan(p prkocomiss_docterm_xie0prkocomiss_docterm)
|
IndexScan(t papi_oper_fndlstbylstacc_xie2papi_oper_fndlstbylstacc) */
|
/*! ForceOrder() */
|
999,
|
t.AccountDebitID
|
FROM pRKOComiss_DocTerm p
|
INNER JOIN pAPI_Oper_FndLstByLstAcc t
|
ON t.spid = p.spid AND t.AccountCreditID = p.ResourceID
|
WHERE p.spid = 999
|
UNION
|
SELECT /*+ IndexScan(p prkocomiss_docterm_xie0prkocomiss_docterm)
|
IndexScan(t papi_oper_fndlstbylstacc_xie2papi_oper_fndlstbylstacc) */
|
/*! ForceOrder() */
|
999,
|
t.AccountCreditID
|
FROM pRKOComiss_DocTerm p
|
INNER JOIN pAPI_Oper_FndLstByLstAcc t
|
ON t.spid = p.spid AND t.AccountCreditID = p.ResourceID
|
WHERE p.spid = 999
|
;
|
QUERY PLAN
|
--------------------------------------------------------------------------------------------------------------------------------------
|
Insert on prkoresource
|
-> Subquery Scan on "*SELECT*"
|
-> HashAggregate
|
Group Key: (999), p.resourceid
|
-> Append
|
-> Group
|
Group Key: p.resourceid
|
-> Index Scan using prkocomiss_docterm_xie0prkocomiss_docterm on prkocomiss_docterm p
|
Index Cond: (((spid)::numeric = '999'::numeric) AND ((accountmethodid)::numeric = '0'::numeric))
|
-> Nested Loop
|
Join Filter: ((p_1.resourceid)::numeric = (t.accountdebitid)::numeric)
|
-> Index Scan using prkocomiss_docterm_xie0prkocomiss_docterm on prkocomiss_docterm p_1
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Index Scan using papi_oper_fndlstbylstacc_xie1papi_oper_fndlstbylstacc on papi_oper_fndlstbylstacc t
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Nested Loop
|
Join Filter: ((p_2.resourceid)::numeric = (t_1.accountdebitid)::numeric)
|
-> Index Scan using prkocomiss_docterm_xie0prkocomiss_docterm on prkocomiss_docterm p_2
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Index Scan using papi_oper_fndlstbylstacc_xie1papi_oper_fndlstbylstacc on papi_oper_fndlstbylstacc t_1
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Nested Loop
|
Join Filter: ((p_3.resourceid)::numeric = (t_2.accountcreditid)::numeric)
|
-> Index Scan using prkocomiss_docterm_xie0prkocomiss_docterm on prkocomiss_docterm p_3
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Index Scan using papi_oper_fndlstbylstacc_xie2papi_oper_fndlstbylstacc on papi_oper_fndlstbylstacc t_2
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Nested Loop
|
Join Filter: ((p_4.resourceid)::numeric = (t_3.accountcreditid)::numeric)
|
-> Index Scan using prkocomiss_docterm_xie0prkocomiss_docterm on prkocomiss_docterm p_4
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Index Scan using papi_oper_fndlstbylstacc_xie2papi_oper_fndlstbylstacc on papi_oper_fndlstbylstacc t_3
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
(33 rows)
|
|
--34922.sql
|
explain (costs off)
|
INSERT INTO pRKOResource
|
(
|
SPID,
|
ResourceID
|
)
|
SELECT /*+ IndexScan(p papi_oper_fndlstbylstacc_xie1papi_oper_fndlstbylstacc) */
|
DISTINCT 999,
|
p.AccountDebitID
|
FROM pAPI_Oper_FndLstByLstAcc p
|
WHERE p.spid = 999
|
UNION
|
SELECT /*+ IndexScan(p papi_oper_fndlstbylstacc_xie2papi_oper_fndlstbylstacc) */
|
DISTINCT 999,
|
p.AccountCreditID
|
FROM pAPI_Oper_FndLstByLstAcc p
|
WHERE p.spid = 999
|
;
|
QUERY PLAN
|
--------------------------------------------------------------------------------------------------------------------------------------------
|
Insert on prkoresource
|
-> Subquery Scan on "*SELECT*"
|
-> Unique
|
-> Sort
|
Sort Key: (999), p.accountdebitid
|
-> Append
|
-> Unique
|
-> Index Scan using papi_oper_fndlstbylstacc_xie1papi_oper_fndlstbylstacc on papi_oper_fndlstbylstacc p
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Unique
|
-> Index Scan using papi_oper_fndlstbylstacc_xie2papi_oper_fndlstbylstacc on papi_oper_fndlstbylstacc p_1
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
(12 rows)
|
|
--------------------auto type cast
|
---
|
set pg_hint_plan.force_cast_index_types = 0;
|
---
|
explain (costs off)
|
SELECT /*+ IndexScan(ob papi_accrual_objdate_xie1papi_accrual_objdate)*/
|
max(ob.EndDate)
|
FROM pAPI_Accrual_ObjDate ob
|
WHERE SPID = '111'::integer
|
AND ob.TemplateNumber = (select max(t1.tt1) from tmp_test_1 t1)::numeric
|
;
|
QUERY PLAN
|
-------------------------------------------------------------------------------------------------
|
Aggregate
|
InitPlan 1 (returns $0)
|
-> Aggregate
|
-> Seq Scan on tmp_test_1 t1
|
-> Index Scan using papi_accrual_objdate_xie1papi_accrual_objdate on papi_accrual_objdate ob
|
Index Cond: ((spid)::numeric = '111'::numeric)
|
Filter: ((templatenumber)::numeric = $0)
|
(7 rows)
|
|
---
|
set pg_hint_plan.force_cast_index_types = 1;
|
---
|
explain (costs off)
|
SELECT /*+ IndexScan(ob papi_accrual_objdate_xie1papi_accrual_objdate)*/
|
max(ob.EndDate)
|
FROM pAPI_Accrual_ObjDate ob
|
WHERE SPID = '111'::integer
|
AND ob.TemplateNumber = (select max(t1.tt1) from tmp_test_1 t1)::numeric
|
;
|
QUERY PLAN
|
-------------------------------------------------------------------------------------------------
|
Aggregate
|
InitPlan 1 (returns $0)
|
-> Aggregate
|
-> Seq Scan on tmp_test_1 t1
|
-> Index Scan using papi_accrual_objdate_xie1papi_accrual_objdate on papi_accrual_objdate ob
|
Index Cond: ((spid)::numeric = '111'::numeric)
|
Filter: ((templatenumber)::numeric = $0)
|
(7 rows)
|
|
---
|
set pg_hint_plan.force_cast_index_types = 0;
|
---
|
explain (costs off)
|
SELECT /*+ IndexScan(ob papi_accrual_objdate_xie1papi_accrual_objdate)*/
|
max(ob.EndDate)
|
FROM pAPI_Accrual_ObjDate ob
|
WHERE SPID = '111'::integer
|
AND ob.TemplateNumber = (select max(t1.tt1) from tmp_test_1 t1)
|
;
|
QUERY PLAN
|
-------------------------------------------------------------------------------------------------
|
Aggregate
|
InitPlan 1 (returns $0)
|
-> Aggregate
|
-> Seq Scan on tmp_test_1 t1
|
-> Index Scan using papi_accrual_objdate_xie1papi_accrual_objdate on papi_accrual_objdate ob
|
Index Cond: ((spid)::numeric = '111'::numeric)
|
Filter: ((templatenumber)::numeric = $0)
|
(7 rows)
|
|
---
|
set pg_hint_plan.force_cast_index_types = 1;
|
---
|
explain (costs off)
|
SELECT /*+ IndexScan(ob papi_accrual_objdate_xie1papi_accrual_objdate)*/
|
max(ob.EndDate)
|
FROM pAPI_Accrual_ObjDate ob
|
WHERE SPID = '111'::integer
|
AND ob.TemplateNumber = (select max(t1.tt1) from tmp_test_1 t1)
|
;
|
QUERY PLAN
|
----------------------------------------------------------------------------------------------------------
|
Aggregate
|
InitPlan 1 (returns $0)
|
-> Aggregate
|
-> Seq Scan on tmp_test_1 t1
|
-> Index Scan using papi_accrual_objdate_xie1papi_accrual_objdate on papi_accrual_objdate ob
|
Index Cond: (((spid)::numeric = '111'::numeric) AND ((templatenumber)::integer = ($0)::integer))
|
(6 rows)
|
|
---
|
set pg_hint_plan.force_cast_index_types = 0;
|
---
|
explain (costs off)
|
SELECT /*+ IndexScan(ob papi_accrual_objdate_xie1papi_accrual_objdate) */
|
max(ob.EndDate)
|
FROM pAPI_Accrual_ObjDate ob
|
WHERE SPID = '111'::integer
|
AND ob.TemplateNumber = (select max(t1.tt1) from tmp_test_1 t1)::integer
|
;
|
QUERY PLAN
|
----------------------------------------------------------------------------------------------------------
|
Aggregate
|
InitPlan 1 (returns $0)
|
-> Aggregate
|
-> Seq Scan on tmp_test_1 t1
|
-> Index Scan using papi_accrual_objdate_xie1papi_accrual_objdate on papi_accrual_objdate ob
|
Index Cond: (((spid)::numeric = '111'::numeric) AND ((templatenumber)::integer = ($0)::integer))
|
(6 rows)
|
|
---
|
set pg_hint_plan.force_cast_index_types = 1;
|
---
|
explain (costs off)
|
SELECT /*+ IndexScan(ob papi_accrual_objdate_xie1papi_accrual_objdate) */
|
max(ob.EndDate)
|
FROM pAPI_Accrual_ObjDate ob
|
WHERE SPID = '111'::integer
|
AND ob.TemplateNumber = (select max(t1.tt1) from tmp_test_1 t1)::integer
|
;
|
QUERY PLAN
|
----------------------------------------------------------------------------------------------------------
|
Aggregate
|
InitPlan 1 (returns $0)
|
-> Aggregate
|
-> Seq Scan on tmp_test_1 t1
|
-> Index Scan using papi_accrual_objdate_xie1papi_accrual_objdate on papi_accrual_objdate ob
|
Index Cond: (((spid)::numeric = '111'::numeric) AND ((templatenumber)::integer = ($0)::integer))
|
(6 rows)
|
|
---
|
set pg_hint_plan.force_cast_index_types = 0;
|
---
|
explain (costs off)
|
UPDATE /*+ IndexScan(obc pdpt_accrual_objdatecorrect_xpkpdpt_accrual_objdatecorrect) */
|
pDPT_Accrual_ObjDateCorrect tab__update
|
SET MaxObjectDate = ( SELECT /*+ IndexScan(ob papi_accrual_objdate_xie1papi_accrual_objdate) */
|
max(ob.EndDate)
|
FROM pAPI_Accrual_ObjDate ob
|
WHERE SPID = obc.SPID AND ob.TemplateNumber = (select max(t1.tt1) from tmp_test_1 t1) /*var_TemplateNumber*/ AND obc.ObjectID = ob.ObjectID)
|
FROM pDPT_Accrual_ObjDateCorrect obc
|
WHERE tab__update.ctid = obc.ctid AND (obc.SPID = 999/*var__SPID_CONSTANT*/)
|
;
|
QUERY PLAN
|
---------------------------------------------------------------------------------------------------------------------------------
|
Update on pdpt_accrual_objdatecorrect tab__update
|
-> Nested Loop
|
-> Index Scan using pdpt_accrual_objdatecorrect_xpkpdpt_accrual_objdatecorrect on pdpt_accrual_objdatecorrect obc
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Tid Scan on pdpt_accrual_objdatecorrect tab__update
|
TID Cond: (ctid = obc.ctid)
|
SubPlan 2
|
-> Aggregate
|
InitPlan 1 (returns $0)
|
-> Aggregate
|
-> Seq Scan on tmp_test_1 t1
|
-> Index Scan using papi_accrual_objdate_xie1papi_accrual_objdate on papi_accrual_objdate ob
|
Index Cond: (((spid)::numeric = (obc.spid)::numeric) AND ((objectid)::numeric = (obc.objectid)::numeric))
|
Filter: ((templatenumber)::numeric = $0)
|
(14 rows)
|
|
---
|
set pg_hint_plan.force_cast_index_types = 1;
|
---
|
explain (costs off)
|
UPDATE /*+ IndexScan(obc pdpt_accrual_objdatecorrect_xpkpdpt_accrual_objdatecorrect) */
|
pDPT_Accrual_ObjDateCorrect tab__update
|
SET MaxObjectDate = ( SELECT /*+ IndexScan(ob papi_accrual_objdate_xie1papi_accrual_objdate) */
|
max(ob.EndDate)
|
FROM pAPI_Accrual_ObjDate ob
|
WHERE SPID = obc.SPID AND ob.TemplateNumber = (select max(t1.tt1) from tmp_test_1 t1) /*var_TemplateNumber*/ AND obc.ObjectID = ob.ObjectID)
|
FROM pDPT_Accrual_ObjDateCorrect obc
|
WHERE tab__update.ctid = obc.ctid AND (obc.SPID = 999/*var__SPID_CONSTANT*/)
|
;
|
QUERY PLAN
|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Update on pdpt_accrual_objdatecorrect tab__update
|
-> Nested Loop
|
-> Index Scan using pdpt_accrual_objdatecorrect_xpkpdpt_accrual_objdatecorrect on pdpt_accrual_objdatecorrect obc
|
Index Cond: ((spid)::numeric = '999'::numeric)
|
-> Tid Scan on pdpt_accrual_objdatecorrect tab__update
|
TID Cond: (ctid = obc.ctid)
|
SubPlan 2
|
-> Aggregate
|
InitPlan 1 (returns $0)
|
-> Aggregate
|
-> Seq Scan on tmp_test_1 t1
|
-> Index Scan using papi_accrual_objdate_xie1papi_accrual_objdate on papi_accrual_objdate ob
|
Index Cond: (((spid)::numeric = (obc.spid)::numeric) AND ((templatenumber)::integer = ($0)::integer) AND ((objectid)::numeric = (obc.objectid)::numeric))
|
(13 rows)
|
|
---
|
set pg_hint_plan.force_cast_index_types = 0;
|
---
|
explain (costs off)
|
UPDATE /*+ IndexScan(al pdpt_accrual_advlucre_xpkpdpt_accrual_advlucre) */
|
pDPT_Accrual_AdvLucre tab__update
|
SET EndDate = coalesce(( SELECT /*+ IndexScan(adl pdpt_accrual_advlucre_xpkpdpt_accrual_advlucre) */
|
(CASE WHEN min(coalesce(adl.PrcDate, CAST('19000101' AS TIMESTAMP without time zone))) = CAST('19000101' AS TIMESTAMP without time zone) THEN al.EndDate ELSE min(adl.PrcDate) END)
|
FROM pDPT_Accrual_AdvLucre adl
|
WHERE adl.SPID = al.SPID AND adl.ObjectID = al.ObjectID AND adl.TemplateNumber = al.TemplateNumber AND adl.BeginDate = al.BeginDate AND adl.EndDate = al.EndDate AND adl.PreparedQty = al.PreparedQty AND adl.Value = al.Value AND adl.Prcnt = al.Prcnt AND adl.TemplateNumberPrc = al.TemplateNumberPrc AND adl.PrcDate <> CAST('19000101' AS TIMESTAMP)), al.EndDate)
|
FROM pDPT_Accrual_AdvLucre al
|
WHERE tab__update.ctid = al.ctid AND (al.SPID = 999/*var__SPID_CONSTANT*/ AND al.TemplateNumber = (select max(t1.tt1) from tmp_test_1 t1) /*var_TemplateNumber*/ AND al.PrcDate = CAST('19000101' AS TIMESTAMP))
|
;
|
QUERY PLAN
|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Update on pdpt_accrual_advlucre tab__update
|
InitPlan 2 (returns $9)
|
-> Aggregate
|
-> Seq Scan on tmp_test_1 t1
|
-> Nested Loop
|
-> Index Scan using pdpt_accrual_advlucre_xpkpdpt_accrual_advlucre on pdpt_accrual_advlucre al
|
Index Cond: (((spid)::numeric = '999'::numeric) AND ((templatenumber)::numeric = $9))
|
Filter: ((prcdate)::timestamp without time zone = 'Mon Jan 01 00:00:00 1900'::timestamp without time zone)
|
-> Tid Scan on pdpt_accrual_advlucre tab__update
|
TID Cond: (ctid = al.ctid)
|
SubPlan 1
|
-> Aggregate
|
-> Index Scan using pdpt_accrual_advlucre_xpkpdpt_accrual_advlucre on pdpt_accrual_advlucre adl
|
Index Cond: (((spid)::numeric = (al.spid)::numeric) AND ((objectid)::numeric = (al.objectid)::numeric) AND ((templatenumber)::numeric = (al.templatenumber)::numeric))
|
Filter: (((prcdate)::timestamp without time zone <> 'Mon Jan 01 00:00:00 1900'::timestamp without time zone) AND ((begindate)::timestamp without time zone = (al.begindate)::timestamp without time zone) AND ((enddate)::timestamp without time zone = (al.enddate)::timestamp without time zone) AND ((preparedqty)::numeric = (al.preparedqty)::numeric) AND ((value)::numeric = (al.value)::numeric) AND ((prcnt)::double precision = (al.prcnt)::double precision) AND ((templatenumberprc)::integer = (al.templatenumberprc)::integer))
|
(15 rows)
|
|
---
|
set pg_hint_plan.force_cast_index_types = 1;
|
---
|
explain (costs off)
|
UPDATE /*+ IndexScan(al pdpt_accrual_advlucre_xpkpdpt_accrual_advlucre) */
|
pDPT_Accrual_AdvLucre tab__update
|
SET EndDate = coalesce(( SELECT /*+ IndexScan(adl pdpt_accrual_advlucre_xpkpdpt_accrual_advlucre) */
|
(CASE WHEN min(coalesce(adl.PrcDate, CAST('19000101' AS TIMESTAMP without time zone))) = CAST('19000101' AS TIMESTAMP without time zone) THEN al.EndDate ELSE min(adl.PrcDate) END)
|
FROM pDPT_Accrual_AdvLucre adl
|
WHERE adl.SPID = al.SPID AND adl.ObjectID = al.ObjectID AND adl.TemplateNumber = al.TemplateNumber AND adl.BeginDate = al.BeginDate AND adl.EndDate = al.EndDate AND adl.PreparedQty = al.PreparedQty AND adl.Value = al.Value AND adl.Prcnt = al.Prcnt AND adl.TemplateNumberPrc = al.TemplateNumberPrc AND adl.PrcDate <> CAST('19000101' AS TIMESTAMP)), al.EndDate)
|
FROM pDPT_Accrual_AdvLucre al
|
WHERE tab__update.ctid = al.ctid AND (al.SPID = 999/*var__SPID_CONSTANT*/ AND al.TemplateNumber = (select max(t1.tt1) from tmp_test_1 t1) /*var_TemplateNumber*/ AND al.PrcDate = CAST('19000101' AS TIMESTAMP))
|
;
|
QUERY PLAN
|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Update on pdpt_accrual_advlucre tab__update
|
InitPlan 2 (returns $9)
|
-> Aggregate
|
-> Seq Scan on tmp_test_1 t1
|
-> Nested Loop
|
-> Index Scan using pdpt_accrual_advlucre_xpkpdpt_accrual_advlucre on pdpt_accrual_advlucre al
|
Index Cond: (((spid)::numeric = '999'::numeric) AND ((templatenumber)::numeric = $9))
|
Filter: ((prcdate)::timestamp without time zone = 'Mon Jan 01 00:00:00 1900'::timestamp without time zone)
|
-> Tid Scan on pdpt_accrual_advlucre tab__update
|
TID Cond: (ctid = al.ctid)
|
SubPlan 1
|
-> Aggregate
|
-> Index Scan using pdpt_accrual_advlucre_xpkpdpt_accrual_advlucre on pdpt_accrual_advlucre adl
|
Index Cond: (((spid)::numeric = (al.spid)::numeric) AND ((objectid)::numeric = (al.objectid)::numeric) AND ((templatenumber)::numeric = (al.templatenumber)::numeric))
|
Filter: (((prcdate)::timestamp without time zone <> 'Mon Jan 01 00:00:00 1900'::timestamp without time zone) AND ((begindate)::timestamp without time zone = (al.begindate)::timestamp without time zone) AND ((enddate)::timestamp without time zone = (al.enddate)::timestamp without time zone) AND ((preparedqty)::numeric = (al.preparedqty)::numeric) AND ((value)::numeric = (al.value)::numeric) AND ((prcnt)::double precision = (al.prcnt)::double precision) AND ((templatenumberprc)::integer = (al.templatenumberprc)::integer))
|
(15 rows)
|