|
-
Good to know about "using no index" clause.
I did a small test, which is not more relevent now after all the posts but maybe helpful to others in future.
Block size of the database is 8k
Code:
create table test_grp(
col1 char(2000),
col2 char(2000),
col3 char(2000),
col4 char(2000),
col5 char(2000),
COLNUM NUMBER
);
/
Insert into test_grp values('a','b','c','d','e',1);
/
1 SELECT COL1, COL2, COL3, col4, col5, SUM(COLNUM)
2 FROM TEST_GRP
3* GROUP BY COL1, COL2, COL3, col4 ,col5
SQL> /
FROM TEST_GRP
*
ERROR at line 2:
ORA-01467: sort key too long
1 SELECT COL1, COL2, COL3, col4, SUM(COLNUM)
2 FROM TEST_GRP
3* GROUP BY COL1, COL2, COL3, col4
It works.
Now I test with using varchar2 column.
Code:
create table test_grpV2(
col1 VARchar2(2000),
col2 VARchar2(2000),
col3 VARchar2(2000),
col4 VARchar2(2000),
col5 VARchar2(2000),
col6 VARchar2(2000),
col7 VARchar2(2000),
col8 VARchar2(2000),
col9 VARchar2(2000),
col10 VARchar2(2000),
col11 VARchar2(2000),
col12 VARchar2(2000),
col13 VARchar2(2000),
col14 VARchar2(2000),
col15 VARchar2(2000),
col16 VARchar2(2000),
col17 VARchar2(2000),
col18 VARchar2(2000),
col19 VARchar2(2000),
col20 VARchar2(2000),
col21 VARchar2(2000),
col22 VARchar2(2000),
col23 VARchar2(2000),
col24 VARchar2(2000),
col25 VARchar2(2000),
col26 VARchar2(2000),
col27 VARchar2(2000),
col28 VARchar2(2000),
col29 VARchar2(2000),
col30 VARchar2(2000),
col31 VARchar2(2000),
col32 VARchar2(2000),
col33 VARchar2(2000),
col34 VARchar2(2000),
col35 VARchar2(2000),
col36 VARchar2(2000),
col37 VARchar2(2000),
col38 VARchar2(2000),
col39 VARchar2(2000),
col40 VARchar2(2000),
COLNUM NUMBER
);
/
INSERT INTO TEST_GRPV2
VALUES('A','B','C','D','E','F','G','H','I','J','K','L',
'M','N','O','P','Q','R','S','T',
'A','B','C','D','E','F','G','H','I','J','K','L',
'M','N','O','P','Q','R','S','T',1);
/
SELECT
COL1, COL2, COL3, col4, col5, col6,col7,
col8,col9,col10,col11,col12,col13,col14,col15,
col16,col17,col18,col19,col20,
col21,col22,col23,col24,col25,coL26,coL27,
coL28,coL29,col30,
COL31, COL32, COL33, coL34, coL35, coL36,
col27,col28,col39,col40,
SUM(COLNUM)
FROM TEST_GRPv2
GROUP BY
COL1, COL2, COL3, col4, col5, col6,col7,
col8,col9,col10,col11,col12,col13,col14,col15,
col16,col17,col18,col19,col20,
col21,col22,col23,col24,col25,coL26,coL27,
coL28,coL29,col30,
COL31, COL32, COL33, coL34, coL35, coL36,
col27,col28,col39,col40
/
which works fine.
Here my point its not about the number of columns in group by clause or with materalized view. Oracle creates a Unique Index on group by columns which has a restriction of total length of BLOCK SIZE.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|