How Oracle use Index?
RDBMS 11.2.0.3Hi all
Suppose I have create the following table and the primary key:
CREATE TABLE DUMMY_I( BOC NUMBER, START_TIME DATE, END_TIME DATE);
ALTER TABLE DUMMY_I
MODIFY (BOC NOT NULL);
ALTER TABLE DUMMY_I
MODIFY (START_TIME NOT NULL);
ALTER TABLE DUMMY_I
ADD CONSTRAINT DUMMY_I_PK PRIMARY KEY
( BOC, START_TIME) ENABLE;
A query with Oracle will use a PK Index:SELECT * FROM
DUMMY_I
WHERE BOC = :v01
AND START_TIME = :v02
But the my dobout is when I need to add field in my query:SELECT * FROM
DUMMY_I
WHERE BOC = :v01
AND START_TIME = :v02
AND END_TIME != :v03
In the example above: how to create an Index to optimize my request?Given that BOC and START_TIME already have an index. Then I should create an Index unique addition field END_TIME and Oracle will use both indexes to optimize my request?
Or
I need to create a new Index with BOC, START_TIME, END_TIME?
Hello
Take a look at this, especially the Index scan to the chapter
http://docs.Oracle.com/CD/E29597_01/server.1111/e16638/optimops.htm#autoId9
Oracle uses indexes in several different ways, which will have much more to understand than a forum thread
of course, if you have a specific question, pull :)
on your original question:
both cases are possible, but
(a) index on BOC, START_TIME, END_TIME - its pretty simple so that it works and as simple good
(b) index on BOC, START_TIME and END_TIME index
Oracle can (but not necessarily will!) use both indexes in a JOIN INDEX, also a long time that you reference that these and any additional unindexed columns (if there is one)
Given this example with queries, one is more appropriate here, but he cannot say in general.
Tags: Database
Similar Questions
-
How Oracle called the hidden for the function-based index columns?
I came across an interesting problem today. Statistics object for a schema that have been created on the basis of data X have been imported into a 'identical' to the database schema Y.The problem is that, on the basis of data X a group of hidden columns associated with index based service (FBIs) were named SYS_NC00182$ to SYS_NC00191$ and on the basis of data Y the same hidden columns were named SYS_NC00183$ to SYS_NC00192$! The consequence was that statistical column for an FBI data base X have been used for a totally different FBI on the database Y.
Now, of course, if this was g 11 or 12 c I could just create virtual columns and those of the index. In this way the names of the columns would be compatible on databases. However, it is a 10g database, and I do not have this option.
I am curious to understand how Oracle generates these hidden column names. I'm also curious if, in 10g, there is a way to identify the name of a column hidden for an FBI that doesn't involve a statement explain plan running on a query that uses all the expressions of the FBI for the table.
The names of $ SYS_NCnnnnn are based on the internal column id - what is loosely based on the order of creation of the FBI. If you delete a column the column internal ids (after this column), which means the names for the SYS_NCnnnnn$ the change. An opportunity to explain your results is that a (real) column on the X data table fell, but the column still exists on the database Y.
If you want to get the link between the current internal name and expression, then you can start with dba_ind_expressions - and create a customized version of the view - e.g @.
Select c.intcol #, c.name, io.name, idx.name, bo.name, base.name, c.default$, ic.pos #.
of sys.col$ c, sys.obj$ idx, basis of sys.obj$, sys.icol$ ic.
sys. User$ io, sys.user$ bo, sys.ind$ I
where bitand(ic.spare1,1) = 1 / * expression * /.
and (bitand (students, 1024) = 0) / * not bmji * /.
and ic.bo # c.obj = #.
and ic.intcol # c.intcol = #.
and ic.bo # base.obj = #.
and io.user # idx.owner = #.
and bo.user # base.owner = #.
and ic.obj # idx.obj = #.
and idx.obj # i.obj = #.
and however # (1, 2, 3, 4, 6, 7, 9)
/
The first two columns in the select ones that I added to the initial view definition.
Concerning
Jonathan Lewis
-
kindly tell how to use the unique value of a table with the index 0
kindly tell how to use the unique value of a table with the index 0
Hi
Yep, use Index Array as Gerd says. Also, using the context help (+ h) and looking through the array palette will help you get an understanding of what each VI does.
This is fundamental LabVIEW stuff, perhaps you'd be better spending some time going through the basics.
-CC
-
How to use layers and colors of the index to even
I work a lot in pixel art. I use indexed images. I need to be able to work in layers while working with indexed colors.
How to use the index while working with layers?
You can't do it in Photoshop.
-
How to use newly created database in oracle
Hi friends,
I created a new database in the name of the model and I dono how to use this database.
can someone help me through the process step by step.
Note: I use the oracle 11g and working in the command prompt
I thank in advance
2749241 wrote:
In fact, I learn about dblink so I need to know how to use it
I created db using DBCA
After I created db as a model and when tried to use the fake database
his spear a mistake as TNS Protocol adapter error...
Help me to enter this dummy database...
Thank you
That error is normally due to the eitehr you have a bad SID or in the service of the database is not started. In order to check what applies to you. Do a Google search for the same mistake.
Aman...
-
How to use the concepts Advanced PL/SQL in oracle reports and forms
Hi all
Can anyone suggest me how to use the Concepts(nested tables,PAA,Varrays,Objects...) Advanced PL/SQL in Oracle forms.
In fact, I created a Table whose column of type Varray. now, I want to create an element in oracle forms on this field. can anyone suggest me how to proceed.
Thank you
KumarHello
Take a look at this one:
http://SheikYerbouti.developpez.com/tutoforms10g/tutoforms10g.htm
especially the chapter on the block that contains a collection of (2.3.3). The sample is built around a nested table, but you get the idea to adapt to work with a varray.Kind regards
AlexIf someone useful or appropriate please mark accordingly.
-
How to use ed in oracle 11g, as we do in 10g
Hello
Anyone can u tell me how to use the text editor in oracle 11g under
We do this in 10g.
Thank you
SrinivasSrinivas wrote:
Hello
I did DEFINE _EDITOR = Notepad
and used his giving ed
A written file afiedt.buf
/ bin/bash: Notebook: command not found1 * Select * from EMP
The last time I checked, for the * nix systems, the parameter + define _editor + has been set at vi . Isn't the notebook as value is for windows or miss me something?
Aman...
-
How to use oracle.jbo.client.remote.ejib. *?
Hello
I think that the oracle.jbo.client.remote.ejib. * package to simplify the interface EJB citing, right? But how to use oracle.jbo.client.remote.ejib. *? example of use code is perfect! Thank you!
Published by: EdwardXiao on September 18, 2011 19:29I'm not sure about the question that you asked... but if you are looking for use, see
http://radio-weblogs.com/0118231/stories/2004/05/07/handcodingDynamicDiscoveryOfEjbdeployedAppmodule.html -
How dynamically update the role of oracle using the trigger
How dynamically update the role of oracle using the trigger:
I have svmanger owner of schema in the database. There are five tables belonged to svmanager.
Table A, B, C, D, E.
I have a role that is played only to these tables under the scheme: SVMANAGER_READ_ONLY
now, if I create a new table F under svmanager. the role that svmanager_read_only does not work is updated, so the user had assigned role cannot access table F.
is there a way to create the trigger for this role dynamically update any when a table is created or deleted?
Thank you.I really really really don't suggest to do this - it's a bad habit. If possible I'd just adding the grant as part of the steps to the role on the new creation of the table.
But for fun here's how you can accomplish this:create or replace procedure execute_grant(v_ddl in varchar2) is begin execute immediate v_ddl; end; /
create or replace trigger catch_create_table_trg after create on schema DECLARE ddl_job number; ddl_str varchar2(50); begin IF ora_dict_obj_type = 'TABLE' THEN ddl_str := 'GRANT SELECT ON '||ora_dict_obj_owner||'.'||ora_dict_obj_name||' TO SVMANAGER_READ_ONLY'; dbms_job.submit(job => ddl_job, what => 'execute_grant(''' || ddl_str || ''');', next_date => sysdate+(5/24/60/60)); END IF; end; /
Test it
create table F (id number(1));
Validate
select * from ROLE_TAB_PRIVS where ROLE = 'SVMANAGER_READ_ONLY';
-
How to use the JKS-based Keystore in Oracle 11g SOA
I'm doing FTPS on remote server of third party (with UNIX operating system) using SOA 11 g adapter FTP. I installed and configured vsftpd and generated vsftpd.pem file on the remote server certificate.
Follow the steps mentioned in http://download.oracle.com/docs/cd/E17904_01/integration.1111/e10231/adptr_file.htm#CIABDGCF
In one step "Adjusting upward the FTP Oracle adapter" walletLocation is necessary, then I went through the steps mentioned in http://download.oracle.com/docs/cd/E17904_01/core.1111/e10105/wallets.htm#CHDGIJDC
(Tried using both 1) JKS Keystore Management 2) portfolio management
Impossible to find two of them in the Oracle 11g SOA em but the steps do not match.
Can someone tell me how to use JKS Keystore or portfolio management?
Thank you very much!!
Concerning
YogeshHi yogesh,
I think that the portfolio can be created from the FMW console only if the HTTP server is installed and available. If there is no Oracle HTTP server, configure a specified in the.
[http://download.oracle.com/docs/cd/E12839_01/doc.1111/e14260/toc.htm |] Oracle HTTP Server installation]
Agress,
Neeraj Sehgal -
How to use the new features of Oracle BAM?
Hi, I read that JDeveloper 11.1.1.2.0 introduced counters, intervals and Indcators business from the perspective of the monitor.
But I can't find the way to display this information in Oracle BAM like I do with sensors. Someone can explain to me how to use it or let me know if there is a documentation on this subject?
Thanks in advance.In addition, you will need to go into the perspective of monitor in the BPEL view and then you can see all the artifacts - interval, meter, indicator of business and the sensors in this point of view. Select lower down on the top right in view BPEL to change perspective.
In addition, installation under SOA_HOME/bam/samples/bam - BAM, there a folder called monitorexpress. Navigate to the directory "/ bin" and run the configure script to load the datamodel and dashboards.
Configure the BAM adapter in the SOA server to make sure that the Monitor objects will receive data from BPEL
THX
Poyard -
How to use the Type of Oracle Table values in the Select statement.
Hello
I get the initial set of values in the Table of Type Records of the Oracle and want to use the list of values in the Select statement.
For example, try something like the following:
TYPE t_record () IS RENDERING
ID TABLEA.ID%type,
NO TABLEA.NO%type
);
v_record t_record;
T_table TYPE IS the v_record TABLE % TYPE;
v_table t_table;
-Code to fill the values of v_table here.
SELECT ID, NO, COLLECT in BULK IN < some other table variabes here > FROM TABLEA
WHERE ID IN (i) v_table USER.USER;
I want to know how to use the Type of Oracle Table values in the Select statement.Something like this:
create or replace type t_record as object ( id number, no number ) / CREATE or replace type t_table AS TABLE OF t_record; / set serveroutput on declare v_table t_table := t_table(); v_t1 t_table := t_table(); begin v_table.extend(1); v_table(1).ID := 1; v_table(1).No := 10; v_table.extend(1); v_table(2).ID := 2; v_table(2).ID := 20; SELEC t_record (ID,NO) BULK COLLECT INTO v_t1 from TableA FROM TABLEA WHERE ID IN (select t.ID from table(v_Table) t); for i in 1..v_t1.count loop dbms_output.put_line(v_t1(i).ID); dbms_output.put_line(v_t1(i).No); end loop; end; /
No test!
P;
Published by: bluefrog on March 5, 2010 17:08
-
How to use this API in Oracle ApEx
I searched for a few days now, trying to find how to use this or any API in the ApEx.
This sounds noobish, but I have no idea how to use. If anyone can help or give me some advice, it would be great.
Hello
ce04a039-2da9-401b-94c9-1d3300bcbb2b wrote:
Please change your user ID to something meaningful. Reference: Video tutorial how to change username available
I searched for a few days now, trying to find how to use this or any API in the ApEx.
This sounds noobish, but I have no idea how to use. If anyone can help or give me some advice, it would be great.
As above given RESTful Web Services Web services API, you can:
- Use a reference to the Web Service created in the shared components and then the process based on this reference page OR
- Use APEX_WEB_SERVICE API to call the above mentioned APEX_JSON API and web services (if you are using APEX 5.0) to parse the JSON response and then further process.
See the following thread: access to the Web Service API
Kind regards
Kiran
-
Oracle: how to use the max() function in expression box
How to use the max() function in the case where expression, please explain with an exampleHope this helps and should be explicit
with t as (select 1 col,100 col2 from dual union select 2 ,100 from dual union select 2 ,200 from dual union select 3,100 from dual union select 3,200 from dual ) select col, case when max(col2)=100 then 'with 100 range' when max(col2)=200 then 'with 200 range' end from t group by col
-
How to load the date and time from text file to oracle using sqlloader table
Hi friends
I need you to show me what I miss loading date and time text file in a table oracle using sqlloader
It's my data in this way (c:\external\my_data.txt)
my table in the database emp27369,SMITH,17-NOV-81,09:14:04,CLERK,20 7499,ALLEN,01-MAY-81,17:06:08,SALESMAN,30 7521,WARD,09-JUN-81,17:06:30,SALESMAN,30 7566,JONES,02-APR-81,09:24:10,MANAGER,20 7654,MARTIN,28-SEP-81,17:24:10,SALESMAN,30
the code for the control in this path (c:\external\ctrl.ctl) filecreate table emp2 (empno number, ename varchar2(20), hiredate date, etime date, ejob varchar2(20), deptno number);
This is the error:load data infile 'C:\external\my_data.txt' into table emp2 fields terminated by ',' (empno, ename, hiredate, etime, ejob, deptno)
any help that I enjoyedC:\>sqlldr scott/tiger control=C:\external\ctrl.ctl SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. Commit point reached - logical record count 5 C:\>
Thank you
Published by: user10947262 on May 31, 2010 09:47load data
INFILE 'C:\external\my_data.txt '.
in the table emp2
fields completed by «,»
(empno, ename, hiredate, etime, Elysa, deptno)Try
load data infile 'C:\external\my_data.txt' into table emp2 fields terminated by ',' (empno, ename, hiredate, etime "to_date(:etime,'hh24:mi:ss')", ejob, deptno)
This is the error:
C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. Commit point reached - logical record count 5 C:\>
This isn't a mistake, you can see errors in the log file and bad.
Maybe you are looking for
-
2450deskjet wireless printer: same message each time I try to download the software for dj2540
I tried several times to get the software downloaded to set up a wireless printer. I do not have a pc cannot use the cd delivered
-
Upgrading RAM on satellite L20-217
Hi guys,. I have a satellite L20-217 and I'm looking to upgrade my ram 256 to 2 GB (or at least 1 GB). I did some research but I am still confused about this module (s) to buy and how to install it. I'm new on this and I will be very grateful if anyo
-
My question is how to check if the for loop complete? I'm controlling a supply of Genesys Lambda and taking a linearity data. I need to check if the loop is completed, ask the user to reverse polarity and resume data. Got only the first part of work.
-
Cannot load Civ4, after downloading patch
I wanted to play online and had to download a patch to do this, after this game would not start (black screen) double click above to return to the office and the message came "failed loading XML file.Assets//xml\GameInfo/Civ4PlayerOptionInfos.xml ".W
-
Muy buenas: Estoy realizando el proyecto final of carrera y me gustaria saber¿como puedo desactivar el CVICALLBACK DelayChanged del example barcode OR hay en?, porque mi objetivo are more este sistema in una cinta y entonces no necesitaria any type o