|
SQL>select table_name from user_tables;
TABLE_NAME |
----------------------------------------------------------------------------
T|
T2|
T1W|
T5K|
Total 4 records.
Use time:5 ms.
SQL>with a as(select (s.rn-1)*10000+t.rn a from t1w t,t5k s)
2 select substr(a,-1,1)x,sum(a)s from a
3 group by substr(a,-1,1)
4 order by 1 parallel 2;
X | S |
----------------------------------------------------------------------------
0| 125000025000000|
1| 124999980000000|
2| 124999985000000|
3| 124999990000000|
4| 124999995000000|
5| 125000000000000|
6| 125000005000000|
7| 125000010000000|
8| 125000015000000|
9| 125000020000000|
Total 10 records.
Use time:22210 ms.
SQL>with t as (select 1 a union select 2)
2 ,t2 as
3 (select rownum rn from
4 (select t.a from t,t t1,t t2,t t3,t t4,t t5,t t6,t t7,t t8,t t9)a,
5 (select t.a from t,t t1,t t2,t t3)b
6 )
7 ,t1w as (select rn from t2 where rn<=10000)
8 ,t5k as (select rn from t2 where rn<=5000)
9 ,a as(select (s.rn-1)*10000+t.rn a from t1w t,t5k s)
10 select substr(a,-1,1)x,sum(a)s from a
11 group by substr(a,-1,1)
12 order by 1 parallel 2;
X | S |
----------------------------------------------------------------------------
0| 125000025000000|
1| 124999980000000|
2| 124999985000000|
3| 124999990000000|
4| 124999995000000|
5| 125000000000000|
6| 125000005000000|
7| 125000010000000|
8| 125000015000000|
9| 125000020000000|
Total 10 records.
Use time:22400 ms. |
|