Group by index column?
hi all,
i have a table as follows
col1 varchar(10),
col2 varchar(10),
col3 number(19,4),
col4 number(19,4)
for this sql statement,
select col1,col2,col3,sum(col4) from table1 group by col1,col2,col3
will an index on(col1,col2,col3) help?
thanks
Since col4 is not in the index, and since you need every value of col4 to compute the sum, then a full-table-scan is very likely the optimal plan, and an index on col1,col2,col3 will be ignored.
If you use a hint to force index use you might actually run slower. One read to get the index entry, a second read to get the data block that contains col4 for that row, resulting in 2 reads for every row instead of 1 read per block (with several rows per block) in a FTS.
Since a full-table-scan is most likely here, db_file_multi_block_read_count can tweak efficiency, as mentioned above.
Similar Messages
-
Why oracle text index column taking long time
why oracle text index column is taking long time to return result.I created text index on a column if I run the query on a single table result is very fast.If I join table with other table (10 records only )
it is taking long time but in explain plan it is searching by index only.
I created this index for searching a varchar2 column,the data is comma seperated values like ( UK,US,IT,BR) and the table having records 20 lakhs.Normally if I query with like operater
( like '%US%' ) it is taking full table scan because I am using '%' both sides. Please help me on this regard how to search the data with less time. Here is may sample code and explain plan.
SQL*Plus: Release 9.2.0.1.0 - Production on Wed Jan 28 16:54:22 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> set timing on
SQL> set linesize 180
SQL> explain plan for SELECT T.esongid FROM (SELECT A.ESONGID FROM wcmedeco.EDECO_ESONGS_TERR_CTRY
A WHERE CONTAINS(A.TERR_CTRY_NAMES,'US')>0
2 GROUP BY A.ESONGID)K,T
3 WHERE K.ESONGID=T.ESONGID;
Explained.
Elapsed: 00:00:00.01
SQL> select *from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 1 | 26 | 4 |
| 1 | NESTED LOOPS | | 1 | 26 | 4 |
| 2 | VIEW | | 1 | 13 | 4 |
| 3 | SORT GROUP BY | | 1 | 89 | 4 |
| 4 | TABLE ACCESS BY INDEX ROWID| EDECO_ESONGS_TERR_CTRY | 1 | 89 | 2 |
| 5 | DOMAIN INDEX | IDX_TERR_CTRY_NAMES | | | 0 |
| 6 | INDEX RANGE SCAN | IDX_ESONGID_T | 1 | 13 | 1 |
PLAN_TABLE_OUTPUT
Note: cpu costing is off, 'PLAN_TABLE' is old version
14 rows selected.
Elapsed: 00:00:00.00
SQL> Regards,
RajasekharYou have not formatted your code properly so we cannot see the query you're executing. Please put some line breaks in.
Secondly, how fresh are the statistics on those tables? Are you really returning one record out of twenty million?
Cheers, APC
blog: http://radiofreetooting.blogspot.com -
Creating a radio button group in a column of a table in Web Dynpro
Hi,
I want to put a radio button group in a column of a table in Webdynpro. I added a column to a web dynpro view and then inserted a tableCellEditor for that column.. But I cannot define it as Radio Button group. I want the user to be able to select 3 statuses using this group.
Does anyone have a solution for this??
Thanks in advance...
NakulHi,
You wont be able create three RB in one cell.
Create as many column as the no of options is.Here it is 3.
Create 4 attributes inside the node , option 1,option 2,option 3 and selectedoption.
Map each RB s keytoSelect to option 1,2,3. Map all the RBs selectedKey atribute to selectedoption.
Now selection for each row will be stored in the selected option.
Regards
Bharathwaj -
ORDER BY ON INDEX COLUMN IS TAKING MORE TIME
Hi,
The following SQL query when executed with ORDER BY is taking 3 mins. If we remove ORDER BY it is taking 32 secs. We have an index on ID which is used in ORDER BY clause. Can any one tell us what could be wrong? My assumption is ORDER BY on an index column should not take that much of time. Is there any configuration that we need to make or missing?
We are on 11g R2.
Query is
SELECT * FROM (SELECT /*+ FIRST_ROWS */ a.*, ROWNUM rnum FROM
(SELECT DISTINCT ENTITYID AS a1, ENTITYCLASS AS a2, STARTDATE AS a3, ENDDATE AS a4, EXTERNALOBJECTID AS a5, LASTMODIFIEDUSER AS a6, ID AS a7, PARTITION AS a8, DESCRIPTION AS a9, NAME AS a10, PERMISSIONS AS a11, CREATEDDATE AS a12, ACTIVITY AS a13, ENTITYVERSION AS a14, EXTERNALNAME AS a15, NOSPEC AS a16,
ADMINSTATE AS a17, OWNER AS a18, LASTMODIFIEDDATE AS a19, EXTERNALARRANGEMENT AS a20, OBJECTSTATE AS a21, EXTERNALMANAGEMENTDOMAIN AS a22,
CREATEDUSER AS a23, SPECIFICATION AS a24 FROM Service WHERE (ENTITYCLASS = 'SERVICEDAO') ORDER BY ID ASC)
a WHERE ROWNUM <= 25) WHERE rnum > 0Here is the explain plan link
https://stbeehive.oracle.com/content/dav/st/Rama%20%20Public%20Workspace/Public%20Documents/explainplan_13339959.JPG
https://stbeehive.oracle.com/content/dav/st/Rama%20%20Public%20Workspace/Public%20Documents/explainplandetailed_13339959.JPG
Thanks,
Rama
Edited by: user9954330 on Nov 8, 2011 1:16 AMuser9954330 wrote:
We replaced the hint with ALL_ROWS. With this change , we observed the query performed worse. Any other pointers? I will provide the other details as given in the template shortly.
Thanks,
RamaThread: HOW TO: Post a SQL statement tuning request - template posting
HOW TO: Post a SQL statement tuning request - template posting -
Gather_table_stats with a method opt of "for all indexed columns size 0"
I have 9 databases I support that contain the same structure, and very similar data concentrations. We are seeing inconsistent performance in the different databases due to bind variable peeking.. I have tracked it down to the Min and Max values that are gathered during the analyze. I analyze from one cluster, and export/import those statistics into the other clusters.. I then go about locking down the stats gathered. Some of the statistics are on tables that contain transient data (the older data is purged, and new data gets a new PK sequence number).
Since I am gathering statistics with a 'FOR ALL INDEXED COLUMNS SIZE 1', a min and max value are grabbed. This value is only appropriate for a short period of time, and only for a specific database. I do want oracle to know the density to help calculate, but I don't want cardinality based on whether the current bind values fall in this range..
Example
COLUMN PK
When I analyze the min is 1 and max is 5. I then let the database run, and the new min is 100 and max is 105.. same number of rows, but different min/max. At first a select * from table where pk>=1 and pk <=5 would return a cardinality of 5.. Later, a seelct * from tables where pk>=100 and pk<=105 would return a cardinaility 1.
Any ideas how to avoid this other than trying set min and max to something myself (like min =1 max = 99999999). ??MarkDPowell wrote:
The Oracle documentation on bind variable peeking said it did not peek without histograms and I cannot remember ever seeing on 9.2 where the trace showed otherwise. Mark,
see this simple test case run on 9.2.0.8. No histograms, but bind variable peeking, as you can see that the EXPLAIN PLAN output generated by AUTOTRACE differs from the estimated cardinality of the actual plan used at runtime.
Which documentation do you refer to?
SQL>
SQL> alter session set nls_language = 'AMERICAN';
Session altered.
SQL>
SQL> drop table bind_peek_test;
Table dropped.
SQL>
SQL> create table bind_peek_test
2 as
3 select
4 100 as n1
5 , cast(dbms_random.string('a', 20) as varchar2(20)) as filler
6 from
7 dual
8 connect by
9 level <= 1000;
Table created.
SQL>
SQL> exec dbms_stats.gather_table_stats(null, 'bind_peek_test', method_opt=>'FOR ALL COLUMNS SIZE 1')
PL/SQL procedure successfully completed.
SQL>
SQL> variable n number
SQL>
SQL> variable n2 number
SQL>
SQL> alter system flush shared_pool;
System altered.
SQL>
SQL> exec :n := 1; :n2 := 50;
PL/SQL procedure successfully completed.
SQL>
SQL> set autotrace traceonly
SQL>
SQL> select * from bind_peek_test where n1 >= :n and n1 <= :n2;
no rows selected
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1000 Bytes=24
000)
1 0 FILTER
2 1 TABLE ACCESS (FULL) OF 'BIND_PEEK_TEST' (Cost=2 Card=100
0 Bytes=24000)
Statistics
236 recursive calls
0 db block gets
35 consistent gets
0 physical reads
0 redo size
299 bytes sent via SQL*Net to client
372 bytes received via SQL*Net from client
1 SQL*Net roundtrips to/from client
4 sorts (memory)
0 sorts (disk)
0 rows processed
SQL>
SQL> set autotrace off
SQL>
SQL> select
2 cardinality
3 from
4 v$sql_plan
5 where
6 cardinality is not null
7 and hash_value in (
8 select
9 hash_value
10 from
11 v$sql
12 where
13 sql_text like 'select * from bind_peek_test%'
14 );
CARDINALITY
1
SQL>
SQL> alter system flush shared_pool;
System altered.
SQL>
SQL> exec :n := 100; :n2 := 100;
PL/SQL procedure successfully completed.
SQL>
SQL> set autotrace traceonly
SQL>
SQL> select * from bind_peek_test where n1 >= :n and n1 <= :n2;
1000 rows selected.
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1000 Bytes=24
000)
1 0 FILTER
2 1 TABLE ACCESS (FULL) OF 'BIND_PEEK_TEST' (Cost=2 Card=100
0 Bytes=24000)
Statistics
236 recursive calls
0 db block gets
102 consistent gets
0 physical reads
0 redo size
34435 bytes sent via SQL*Net to client
1109 bytes received via SQL*Net from client
68 SQL*Net roundtrips to/from client
4 sorts (memory)
0 sorts (disk)
1000 rows processed
SQL>
SQL> set autotrace off
SQL>
SQL> select
2 cardinality
3 from
4 v$sql_plan
5 where
6 cardinality is not null
7 and hash_value = (
8 select
9 hash_value
10 from
11 v$sql
12 where
13 sql_text like 'select * from bind_peek_test%'
14 );
CARDINALITY
1000
SQL>
SQL> spool offRegards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
11g: automatic group by unused column
Hi,
I've got this problem:
I have report with just one measure. This measure should be aggregated over a selectable dimension.
Therefor I build a dashboard prompt, which saves the selected dimension in a presentation variable.
(btw: a column selector would be the easier way, but there are more than one report which should react on this dashboard prompt)
Then I used a "case when" in the report to differ between the selection:
case when [presentation-variable] = 'Dim1' then Dim1.col1
when [presentation-variable] = 'Dim2' then Dim2.col1
end
Now I would expect such a physical SQL:
select
case when [presentation-variable] = 'Dim1' then Dim1.col1 when [presentation-variable] = 'Dim2' then Dim2.col1 end,
sum(...)
from
group by
case when [presentation-variable] = 'Dim1' then Dim1.col1 when [presentation-variable] = 'Dim2' then Dim2.col1 end;
But OBIEE creates such one:
select
case when [presentation-variable] = 'Dim1' then Dim1.col1 when [presentation-variable] = 'Dim2' then Dim2.col1 end,
sum(...)
from
group by
Dim1.col1,
Dim2.col1,
case when [presentation-variable] = 'Dim1' then Dim1.col1 when [presentation-variable] = 'Dim2' then Dim2.col1 end;
So of course the wrong the measure is aggregated wrong, because it is grouped by a column, which i do not want to use.
Could it be the Problem, that this 2 columns are logical level key of a dimension hierarchy?
Anybody got a idea, how I could suppress this group by?Hi,
Just 4 hours ago, someone else had a very similar question:
Group by fails on ORA-00979
Personally, I consider that a bug in Oracle 10. When you do a GROUP BY on a view, you can't expect the SQL engine to look at the view definition, and determine if one of the columns can be derived from another.
In practice, it's easy enough to add c1u to the GROUP BY clause, or to use MAX (c1u) instead of c1u, to make your query work. -
How to Create Dynamic RadioButton Group by Index
Hi to all,
I would like to create an Questionaire.For that, I have created one Text View & Radio button Group by index at design time. which will fetch the values(ie Values are Questions & Ans options ) from R/3. since I need to fetch N number of values which must be mapped with Multiple Text views & Radio Button Groups i want to create Text view & Radio button Group by index UI Elements dynamically.How to do that?
Please bring me an solution to this problem.
Thanks in advance.
Regards,
Malar.Hi Murtuza,
Thanks for ur solution...
anyway again i got an same error. Option button not enabled...
so i have created a dynamic context node & map it with the RadioButton Group by Index...Now it s working fine...
if(firstTime){
//Test2Node.invalidate();
for(int i=0;i<wdContext.nodeQuestions().size();i++)
IWDNodeInfo nodeinfo=wdContext.getNodeInfo();
/* This will add a ValueNode */
IWDNodeInfo customerNode=nodeinfo.addChild("Questionaire"+i,null,true,true,true,false,false,true,null,null,null);
/* This will add a Attribute to the above Node */
IWDAttributeInfo custAttr=customerNode.addAttribute("Quest"+i,"com.sap.dictionary.string");
IWDAttributeInfo custAttr1=customerNode.addAttribute("Options"+i,"com.sap.dictionary.string");
IWDNode NodeQuest = wdContext.getChildNode("Questionaire"+i,0);
NodeQuest.getCurrentElement().setAttributeValue("Quest"+i,wdContext.nodeQuestions().getQuestionsElementAt(i).getQues());
// NodeQuest.getCurrentElement().setAttributeValue("Options"+i,wdContext.nodeQuestions().getQuestionsElementAt(i).getOptionA());
IWDTransparentContainer tc = (IWDTransparentContainer)view.getElement("TransparentContainer");
IWDTextView tv =(IWDTextView) view.createElement(IWDTextView.class,"MyTextView1"+i);
tv.setText(wdContext.nodeQuestions().getQuestionsElementAt(i).getQues());
tc.addChild(tv);
IWDNodeElement NodeElt= NodeQuest.createElement();
NodeElt.setAttributeValue("Options"+i,wdContext.nodeQuestions().getQuestionsElementAt(i).getOptionA());
NodeQuest.addElement(NodeElt);
IWDNodeElement NodeElt1= NodeQuest.createElement();
NodeElt1.setAttributeValue("Options"+i,wdContext.nodeQuestions().getQuestionsElementAt(i).getOptionB());
NodeQuest.addElement(NodeElt1);
IWDNodeElement NodeElt2= NodeQuest.createElement();
NodeElt2.setAttributeValue("Options"+i,wdContext.nodeQuestions().getQuestionsElementAt(i).getOptionC());
NodeQuest.addElement(NodeElt2);
IWDNodeElement NodeElt3= NodeQuest.createElement();
NodeElt3.setAttributeValue("Options"+i,wdContext.nodeQuestions().getQuestionsElementAt(i).getOptionD());
NodeQuest.addElement(NodeElt3);
IWDRadioButtonGroupByIndex rbg = (IWDRadioButtonGroupByIndex)view.createElement(IWDRadioButtonGroupByIndex.class,"RBG1"+i);
rbg.bindTexts("Questionaire"i".Options"+i);
//IWDRadioButton rb = (IWDRadioButton)view.createElement(IWDRadioButton.class,"RBG1"+Iter);
//rb.bindText("Test2.RadioTest");
tc.addChild(rbg);
This s the code....
Thank you. anyway
Regards,
Thenmalar -
Default Filter Criteria - "Current (Indexed)" Column?
Hello Technet,
When you create a "Standard View" in SharePoint online, if you look under the Filter section, a default filter is automatically added on the "Current (Indexed)" column, causing the list to show only list items that have Current = Yes.
My question is in two parts;
What does this Current (Indexed) column mean/do?
Why, as my list approached 2500 items, are many of the newly created list items not showing in views that have this criteria?
I am unable to find that column when I modify the list so I assume it has something to do with SharePoint's automatic version control. I'm not getting why all of a sudden this would not be working? One thought, I do know that SharePoint lists
are limited to a 5,000 item limit, is it possible the "versions" list, if that exists on the back-end, has gotten too large and is no longer saving items?As there is no default view with a filter already enabled OOTB I would suggest you to create a service ticket at O365 support or via MS Premier Support.
Michiel Hamers www.SharePointman.nl Don't hesitate to contact me for a SharePoint/O365 question. -
Indexed columns became unusable. how to resolve it
Hi All,
i have truncated the data using alter command as follows .
alter table table_one truncate partition (partitionname);
After that i was trying to insert data into that table am getting an error. And all indexes columns became unusable. i think doing truncate the partition i am facing this problem.
can any one suggest me to how to make it.. usable.
i am using tode
Thanks
Sree874823 wrote:
Hi All,
i have truncated the data using alter command as follows .
alter table table_one truncate partition (partitionname);
After that i was trying to insert data into that table am getting an error. And all indexes columns became unusable. i think doing truncate the partition i am facing this problem.
can any one suggest me to how to make it.. usable.
i am using tode
Thanks
SreeI assume you have an unusable global index?
http://docs.oracle.com/cd/B10501_01/server.920/a96521/partiti.htm#27573
Rebuild the index, and next time include the "update global indexes" clause with the truncate command. -
What value, one should use for method_opt , while collecting stats for database/schema/table.
It is obseverd AUTO never give good result, in some case "for all indexed columns 1" work fine and some case "for all indexed columns 254".
Please advise , what is right way to collect stats.
OS : Linux AS 4
DB : 9.2.0.8 , 10.2.0.3
ThanksGather AUTO. Gathers all necessary statistics automatically. Oracle implicitly determines which objects need new statistics, and determines how to gather those statistics. When GATHER AUTO is specified, the only additional valid parameters are stattab, statid, objlist and statown; all other parameter settings are ignored. Returns a list of processed objects.
If you specify the for all indexed columns, or specify the column, it will gather histograms. Those are useful if you have an uneven data distribution, and are specially useful for DSS databases, where Oracle will determine if a column is suitable, on a given data rage, to perform full table scan or index scan. If uncertain about it I suggest you not to gather column statistics, as they are costly.
~ Madrid. -
Bug in ODT 11720 - indexed columns list in Design Table is disabled
Start VS2008
Server Explorer
Expand any oracle db
Expand Tables
Design any existing table that has an existing index that indexes more than 3 columns
Click Indexes tab
Click the index name
Try to scroll the list of indexed columns, because youre curious which columns are indexed and what order
You cant, because the control is disabledChecks should be made to see if other controls (such as the text box for CHECK code, or the list for PKs) are similarly affected
-
Grouping by 2 columns. Please see
Hi,
I am using Reports 9I.
I need to use two group by's :
Table:
TRANS_ID ACC_ID DEL CCY AMT TRADE_DAT LENDER
LEL0002045 SLEND RECEIVE GBP 1200 02-AUG-05 LENDERA
LEL0002053 SLEND DELIVER GBP 1000 02-AUG-05 LENDERA
LEL0002100 SLEND DELIVER USD 500 02-AUG-05 LENDERB
LEL0002000 SLEND DELIVER KRN 1000 03-AUG-05 LENDERC
LEL0002002 SLEND DELIVER KRN 1000 03-AUG-05 LENDERA
LEL0002001 SLEND DELIVER GBP 1000 03-AUG-05 LENDERA
REPORT
LEL0002045 SLEND RECEIVE GBP 1200 02-AUG-05 LENDERA
LEL0002053 SLEND DELIVER GBP 1000 02-AUG-05 LENDERA
LEL0002001 SLEND DELIVER GBP 1000 03-AUG-05 LENDERA
LEL0002002 SLEND DELIVER KRN 1000 03-AUG-05 LENDERA
RECEIVE GBP 1200
DELIVER GBP 2000
DELIVER KRN 1000The break is on DEL and then on the CCY (ie currency).
I am using the flwg SQL Query in my report:
SELECT trans_id,
acc_id,
decode(DEL,'RECEIVE', AMT,0) as REC_AMT,
decode(DEL,'DELIVER', AMT,0) as DEL_AMT,
ccy,
amt,
trade_date,
lender
FROM TableAand using SUMMARY cols to sum the AMT for column DEL
But now,i need to sum also on column CCY.How do I sum AMT first on col DEL
and then on col CCY?
Is my SQL query proper? Any suggestions to modify this ?You provided following format:
ccy transid accId rec Amt
lenderA
GBP LEL001 SLEND RECEIVE 1000
GBP LEL002 SLEND RECEIVE 1200
GBP LEL003 SLEND DELIVER 1000
USD LEL004 SLEND RECEIVE 1000
RECEIVE GBP 3000
DELIVER USD 1000
BUT, I THINK YOU WANTED IN THIS FORMAT
GBP LEL001 SLEND RECEIVE 1000
GBP LEL002 SLEND RECEIVE 1200
GBP LEL003 SLEND DELIVER 1000
USD LEL004 SLEND RECEIVE 1000
RECEIVE GBP 2200
DELIVER GPB 1000
RECEIVE USD 1000
If i am right, then you need two groups, one on LENDER and other rest of the column, lets say it 'DETAIL'.
Create 4 formula columns in detail group
First Formula Column:
if :del = 'RECEIVE' and ccy = 'GPB' then
return(:amt);
else
return(0);
end if;
Second Formula Column:
if :del = 'RECEIVE' and ccy = 'USD' then
return(:amt);
else
return(0);
end if;
Third Formula Column:
if :del = 'DELIVER' and ccy = 'GPB' then
return(:amt);
else
return(0);
end if;
Fourth Formula Column:
if :del = 'DELIVER' and ccy = 'USD' then
return(:amt);
else
return(0);
end if;
Create four summary column in LENDER group based on these formula columns and reset at LENDER.
Put these summary column in repeating frame of LENDER.
This will work if you are only dealing with 'USD' and GBP' -
I have one table as below
CREATE TABLE [dbo].[emp](
[EmpId] INT,
[EmpName] VARCHAR(20),
[SAL] INT,
[DeptId] INT
) ON [PRIMARY]
I want to select all column with group by one column
SELECT EmpId, EmpName, SAL, DeptId FROM Emp GROUP BY DeptId
Is it possible ?
Is there any other way to achieve this?
Deepak Talele Ph: 91-9158413830 Email: [email protected], [email protected]Hi,
If you want to select all the columns then what is the need of group by?
Group By normally used when you have math function in your query like, SUM() , COUNT(), MIN(), MAX() etc
Could you please provide us with sample output that you are trying to achieve.
Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
Praveen Dsa | MCITP - Database Administrator 2008 |
My Blog | My Page -
Order of indexed columns in the index
Hi Gurus,
I have a small problem in front of me and I wud like to take some inputs
from you Gurus.Here is question
1. Is order of the index is important in CBO?
say
1.I have a concatenated index on col1,col2
2.In the sql statement's used in my project I have statements "where
col1=1 and col2 = 1" as well as
"where col2=1 and col1=1" and my opinion is that CBO will use the Index
in both the scenarios( I have cheked RBO for the same and RBO is able to
use the index) whereas some senior persons out here are telling
otherwise..... that it will not use the index for "where col2=1 and
Col1=1)
pls clarify
Cheers
Sriram KumarWhen I attended an Oracle 8i SQL Statement Tuning Workshop, I believe I understood things as in the response above. However, the class was applicable to Oracle 8.1.5 and I am now using Oracle 8.1.7, so some things may have changed. I have included a test of various scenarios below. I would have expected all except the last one to use the index, because col2 is not the leading edge of the composite index on col1, col2. Much to my surprise it also used the index there.
SQL> CREATE TABLE test_table AS
2 SELECT empno col1, mgr col2 FROM emp
3 /
Table created.
SQL> UPDATE test_table
2 SET col1 = 1, col2 = 1
3 WHERE col1 = 7782
4 AND col2 = 7839
5 /
1 row updated.
SQL> CREATE INDEX test_idx
2 ON test_table (col1, col2)
3 /
Index created.
SQL> ANALYZE TABLE test_table
2 COMPUTE STATISTICS
3 FOR TABLE
4 FOR ALL INDEXES
5 FOR ALL INDEXED COLUMNS
6 /
Table analyzed.
SQL> SET AUTOTRACE ON EXPLAIN
SQL> SELECT * FROM test_table
2 WHERE col1 = 1 AND col2 = 1
3 /
COL1 COL2
1 1
1 row selected.
Execution Plan
0
SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1 Bytes=6)
1 0
INDEX (RANGE SCAN) OF 'TEST_IDX' (NON-UNIQUE) (Cost=1 Card
=1 Bytes=6)
SQL> SELECT * FROM test_table
2 WHERE col2 = 1 AND col1 = 1
3 /
COL1 COL2
1 1
1 row selected.
Execution Plan
0
SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1 Bytes=6)
1 0
INDEX (RANGE SCAN) OF 'TEST_IDX' (NON-UNIQUE) (Cost=1 Card
=1 Bytes=6)
SQL> SELECT * FROM test_table
2 WHERE col1 = 1
3 /
COL1 COL2
1 1
1 row selected.
Execution Plan
0
SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1 Bytes=6)
1 0
INDEX (RANGE SCAN) OF 'TEST_IDX' (NON-UNIQUE) (Cost=1 Card
=1 Bytes=6)
SQL> SELECT * FROM test_table
2 WHERE col2 = 1
3 /
COL1 COL2
1 1
1 row selected.
Execution Plan
0
SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1 Bytes=6)
1 0
INDEX (FULL SCAN) OF 'TEST_IDX' (NON-UNIQUE) (Cost=1 Card=
1 Bytes=6) -
Selectively Format Groups with Multiple Columns
I have a bit of an obscure task I've been trying to hammer out to no avail. I've searched quite a bit but can't seem to find anyone else who has attempted this. I have two group by statements, one is a category and the other is a rank. What I'm trying to do is organize the report so that there are category rows and below each category row is a set of columns for each rank with their associated values as such:
category1
rank1 rank2 rank3 rank4
value1 value1 value1 value1
value2 value2 value2 value2
category2
rank1 rank2 rank3
value1 value1 value1
value2 value2 value2
I've tried using details>Section Expert>>Layout>Format Groups with multiple column. Unfortunately, this applies to both groups putting the categories into columns instead of rows, making a mess. Does anyone know of a way to selectively put groups into columns and ensure alignment? In the above example the user would be able to compare rank values from multiple categories since they all line up. Any help with this would be very much appreciated.Hi,
Have you tried using a crosstab? Give this a shot:
1) Group the report on Category
2) Create a new group header section. Group Header b
3) Place a crosstab in this section
4) The columns would be the Rank field, I'm not sure about what you would like to show in the rows
5) The summarized field would be the Value field ofcourse
Let me know how this goes.
-Abhilash
Maybe you are looking for
-
Simple Webserver SocketException: socket write error
I'm stuck and need some help solving this problem. When I try to get the 404 message with the webserver, I get this in the output console: "HttpRequest - java.net.SocketException: Connection reset by peer: socket write error" I have found the part th
-
Hi, Can any one tell me how to create cost sheet for each production order. As each cost sheet has different rates for material overhead, production over head and admin overhead. Whether one cost sheet is sufficient to maintain overhead rates. Please
-
Best Wireless Mouse for iMac?
I like my Mighty Mouse, but I think its time to upgrade to a wireless mouse and I don't think the Mighty Mouse fits the bill. I use iMovie and iPhoto a lot, and casual gamer (currently playing World of Goo - which is awesome BTW). Any recommendations
-
Blackberry Torch 9800 Khmer unicode
Dear sir/mardam Blackberry Torch 9800 can unstall khmer unicode? and also cannot connect wifi.
-
Can't charge iPod nano 4G through AC adapter
Hey I've got a AC adapter for iPod *nano 2G*. and I bought an ipod nano 4G recently and found that I wasn't able to charge it with the AC adapter I bought for nano 2G. And Idea?