Oracle 10.2.0.4 Index on timestamp column not used when SYSTIMESTAMP Used.
Hi,
I have a table A with a column B timestamp(6). The tables contains around 300000 rows..
I have created index 'idx' on the column B.
When i compare column 'B' with systimestamp, it does not use the index, whereas if i compare 'B' with sysdate it uses the index.
Eg :
select count(*) from a where b<=sysdate;
The above used the index 'idx' and executed in 1 second
select count(*) from a where b<=systimestamp;
The above does not use the index and executed in 19 seconds.
Any Clue?
Thanks in Advance
Oracle is using Internal functions when you use SYSTIMESTAMP:
Work around will be to use TO_TIMESTAMP as shown below.. Or define a function based index..
You can check performance problem querying against a "TIMESTAMP WITH TIME ZONE" column link also
SQL> create table a(b timestamp(6));
Table created.
SQL> insert into a
2 select systimestamp+(level/24) from dual connect by level <= 30000;
30000 rows created.
SQL> commit;
Commit complete.
SQL> create index ndx on a(b);
Index created.
SQL> explain plan for
2 select count(*) from a where b <= sysdate;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 3858831102
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 13 | 1 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 13 | | |
|* 2 | INDEX RANGE SCAN| NDX | 1 | 13 | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("B"<=SYSDATE@!)
Note
- dynamic sampling used for this statement
18 rows selected.
SQL> explain plan for
2 select count(*) from a where b <= systimestamp;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 3918351354
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 13 | 20 (15)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 13 | | |
|* 2 | TABLE ACCESS FULL| A | 1 | 13 | 20 (15)| 00:00:01 |
Predicate Information (identified by operation id):
2 - filter(SYS_EXTRACT_UTC(INTERNAL_FUNCTION("B"))<=SYS_EXTRACT_UTC(S
YSTIMESTAMP(6)))
Note
- dynamic sampling used for this statement
19 rows selected.
--"Just tried using TO_TIMESTAMP"
SQL> explain plan for
2 select count(*) from a where b <= to_timestamp(systimestamp);
Explained.
SQL>
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 3858831102
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 13 | 2 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 13 | | |
|* 2 | INDEX RANGE SCAN| NDX | 4 | 52 | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("B"<=TO_TIMESTAMP(TO_CHAR(SYSTIMESTAMP(6))))
14 rows selected.Edited by: jeneesh on Oct 23, 2012 11:18 AM
Similar Messages
-
On updating to Yosemite Mail Index damaged but does not repair when re-opening mail.
Yosemite updated but Mail index damaged and does not repair when re-opened. How is this fixed?
I have the same thing happening. Everything else seems to be working fine, except i can't open my mac mail at all! it seems to be in a loop and won't let me retrieve any mail or even try to send mail before migrating, but it fails and then its back to the beginning and the same loop continues, so no mac mail working. I also came from 10.6.8 to 10.10
jane -
Spotlight indexing in mail is not working when I search, since 10.4.8 combo
Hi
I have noticed every since I installed the intel 10.4.8 combo update I have been unable to search my mail in Mail.
I assuming that it is spotlight that indexes the mail boxes. Though this only appears to be a problem when I am searching using the search box in Mail.
When I use the top right hand spotlight icon it works fine.
Does anyone know how to fix the search in Mail?
Thanks in advance.I mean the search box in Mail itself and when
you search how it filters down in your inbox.
Actually, if you pay closer attention to what David has told you, you will see the banner he mentions provides for searching all mailboxes or the currently selected one, not just the Inbox, & for searching on the entire message; or the from, to, or subject fields alone.
The banner appears after doing any search using Mail's search box, even ones with zero results.
David wants to know what options are selected in that banner. -
Index within timestamp column of XML datatype
Team , Thanks for your help in advance !
I'm looking out for some suggestions about creating indexes within XML datatype , Preferably a timestamp . Pasted below sample xml data ..I'm googling it in the interim while some one help me here .
<RingBufferTarget truncated="0" processingTime="0" totalEventsProcessed="2" eventCount="2" droppedCount="0" memoryUsed="1054">
<event name="object_created" package="sqlserver" timestamp="2015-03-09T08:20:17.550Z">
<data name="database_id">
<type name="uint32" package="package0" />
<value>41</value>
</data>
<data name="object_id">
<type name="int32" package="package0" />
<value>933578364</value>
</data>
<data name="object_type">
<type name="object_type" package="sqlserver" />
<value>8277</value>
<text>USRTAB</text>
</data>
<data name="index_id">
<type name="uint32" package="package0" />
<value>0</value>
</data>
<data name="related_object_id">
<type name="int32" package="package0" />
<value>0</value>
</data>
<data name="ddl_phase">
<type name="ddl_opcode" package="sqlserver" />
<value>0</value>
<text>Begin</text>
</data>
<data name="transaction_id">
<type name="int64" package="package0" />
<value>284364642</value>
</data>
<data name="object_name">
<type name="unicode_string" package="package0" />
<value>DUMMY</value>
</data>
<data name="database_name">
<type name="unicode_string" package="package0" />
<value />
</data>
<action name="cpu_id" package="sqlos">
<type name="uint32" package="package0" />
<value>0</value>
</action>
<action name="task_time" package="sqlos">
<type name="uint64" package="package0" />
<value>14322587</value>
</action>
<action name="client_app_name" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>Microsoft SQL Server Management Studio - Query</value>
</action>
<action name="client_hostname" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>VDDBARY</value>
</action>
<action name="database_name" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>TEST_R_D</value>
</action>
<action name="nt_username" package="sqlserver">
<type name="unicode_string" package="package0" />
<value />
</action>
<action name="server_instance_name" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>SQLDEV01</value>
</action>
<action name="server_principal_name" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>ryelug01</value>
</action>
<action name="session_id" package="sqlserver">
<type name="uint16" package="package0" />
<value>99</value>
</action>
<action name="session_nt_username" package="sqlserver">
<type name="unicode_string" package="package0" />
<value />
</action>
<action name="session_resource_group_id" package="sqlserver">
<type name="uint32" package="package0" />
<value>2</value>
</action>
<action name="sql_text" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>USE TEST_R_d
CREATE TABLE DUMMY
id int not null
)</value>
</action>
<action name="username" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>ryelug01</value>
</action>
</event>
<event name="object_created" package="sqlserver" timestamp="2015-03-09T08:20:17.552Z">
<data name="database_id">
<type name="uint32" package="package0" />
<value>41</value>
</data>
<data name="object_id">
<type name="int32" package="package0" />
<value>933578364</value>
</data>
<data name="object_type">
<type name="object_type" package="sqlserver" />
<value>8277</value>
<text>USRTAB</text>
</data>
<data name="index_id">
<type name="uint32" package="package0" />
<value>0</value>
</data>
<data name="related_object_id">
<type name="int32" package="package0" />
<value>0</value>
</data>
<data name="ddl_phase">
<type name="ddl_opcode" package="sqlserver" />
<value>1</value>
<text>Commit</text>
</data>
<data name="transaction_id">
<type name="int64" package="package0" />
<value>284364642</value>
</data>
<data name="object_name">
<type name="unicode_string" package="package0" />
<value>DUMMY</value>
</data>
<data name="database_name">
<type name="unicode_string" package="package0" />
<value />
</data>
<action name="cpu_id" package="sqlos">
<type name="uint32" package="package0" />
<value>0</value>
</action>
<action name="task_time" package="sqlos">
<type name="uint64" package="package0" />
<value>14322583</value>
</action>
<action name="client_app_name" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>Microsoft SQL Server Management Studio - Query</value>
</action>
<action name="client_hostname" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>VDDBARY</value>
</action>
<action name="database_name" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>TEST_R_D</value>
</action>
<action name="nt_username" package="sqlserver">
<type name="unicode_string" package="package0" />
<value />
</action>
<action name="server_instance_name" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>SQLDEV01</value>
</action>
<action name="server_principal_name" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>ryelug01</value>
</action>
<action name="session_id" package="sqlserver">
<type name="uint16" package="package0" />
<value>99</value>
</action>
<action name="session_nt_username" package="sqlserver">
<type name="unicode_string" package="package0" />
<value />
</action>
<action name="session_resource_group_id" package="sqlserver">
<type name="uint32" package="package0" />
<value>2</value>
</action>
<action name="sql_text" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>USE TEST_R_d
CREATE TABLE DUMMY
id int not null
)</value>
</action>
<action name="username" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>ryelug01</value>
</action>
</event>
</RingBufferTarget>
Rajkumar YeluguThanks for the link Visakh !
It helps me getting started , I applied few tips on to my ongoing stored proc ( Below ) but not a great improvement though , Thanks for your further assistance .
CREATE TABLE #XML_Hold
ID INT NOT NULL IDENTITY(1,1) PRIMARY KEY , -- PK necessity for Indexing on XML Col
BufferXml XML
INSERT INTO #XML_Hold (BufferXml)
SELECT
CAST(target_data AS XML) AS TargetData --BufferXml
FROM sys.dm_xe_session_targets xet
INNER JOIN sys.dm_xe_sessions xes
ON xes.address = xet.event_session_address
WHERE xes.name = 'Capture DDL Schema Changes'
--RETURN
SELECT GETDATE() AS GETDATE_1
CREATE PRIMARY XML INDEX [IX_XML_Hold] ON #XML_Hold(BufferXml) -- Ryelugu 03/09/2015 - Primary Index
SELECT GETDATE() AS GETDATE_2
--create secondary xml value index
CREATE XML INDEX [IX_XML_Hold_values] ON #XML_Hold(BufferXml)
USING XML INDEX [IX_XML_Hold]
FOR VALUE
SELECT GETDATE() AS GETDATE_3
SELECT
p.q.value('@name[1]','varchar(100)') AS eventname,
p.q.value('@timestamp[1]','datetime') AS timestampvalue,
p.q.value('(./data[@name="object_name"]/value)[1]','varchar(100)') AS objectname,
p.q.value('(./data[@name="object_type"]/text)[1]','varchar(100)') AS ObjectType,
p.q.value('(./action[@name="database_name"]/value)[1]','varchar(100)') AS databasename,
p.q.value('(./data[@name="ddl_phase"]/text)[1]','varchar(100)') AS ddl_phase,
p.q.value('(./action[@name="client_app_name"]/value)[1]','varchar(100)') AS clientappname,
p.q.value('(./action[@name="client_hostname"]/value)[1]','varchar(100)') AS clienthostname,
p.q.value('(./action[@name="server_instance_name"]/value)[1]','varchar(100)') AS server_instance_name,
p.q.value('(./action[@name="nt_username"]/value)[1]','varchar(100)') AS nt_username,
p.q.value('(./action[@name="server_principal_name"]/value)[1]','varchar(100)') AS serverprincipalname,
p.q.value('(./action[@name="sql_text"]/value)[1]','Nvarchar(max)') AS sqltext
FROM #XML_Hold
CROSS APPLY BufferXml.nodes('/RingBufferTarget/event')p(q)
WHERE -- Ryelugu 03/05/2015 -
p.q.value('@timestamp[1]','datetime') >= ISNULL(@Prev_Insertion_time ,p.q.value('@timestamp[1]','datetime'))
AND p.q.value('(./data[@name="ddl_phase"]/text)[1]','varchar(100)') ='Commit'
AND p.q.value('(./data[@name="object_type"]/text)[1]','varchar(100)') <> 'STATISTICS'
AND p.q.value('(./data[@name="object_name"]/value)[1]','varchar(100)') NOT LIKE '%#%'
It appears that filtering and selecting from #XML_Hold is TIME taking .
Rajkumar Yelugu -
ODBC errors while retrieving timestamp column
Hi,
I created 2 views selecting timestamp column of table ULTBPM_CCHK.CC_APPINFO:
CREATE OR REPLACE FORCE VIEW "ULTBPM_CCHK"."ERKANDENE_V" ("CCAI_RECORDDATETIME") AS select TO_DATE(TO_CHAR(CCAI_RECORDDATETIME,'DD/MM/YYYY hh24:mi:ss'),'DD/MM/YYY
Y hh24:mi:ss') CCAI_RECORDDATETIME from ULTBPM_CCHK.CC_APPINFO;
CREATE OR REPLACE VIEW "ULTBPM_CCHK"."ERKANDENE_V2"
"CCAI_RECORDDATETIME") AS select CCAI_RECORDDATETIME from ULTBPM_CCHK.CC_APPINFO;
While i can query "ULTBPM_CCHK"."ERKANDENE_V" without any problem, following errror occurs for "ULTBPM_CCHK"."ERKANDENE_V2":
SELECT AL1.CCAI_RECORDDATETIME FROM ULTBPM_CCHK.ERKANDENE_V2 AL1
ODBC Error: SQL API: [SQLBindCol], SQL RETURN: [-1], SQL STATE: [HY003], SQL NATIVE ERROR: [0], SQL MESSAGE: [[Microsoft][ODBC Driver Manager] Program type out of range]
I want to select timestamp colum, Any sugestions?
Hyperion Reporting Studio 9.3.1
Oracle 9i clent
Oracle 10g (10.2.0.4) database
Regards,
Erkan SakaHi,
This time it gives "ORA-03106: fatal two-task communication protocol error". I searched metalink and fould that this may be caused by incompatible SqlNet libraries or NLS settings between cklient and server. I checked NLS settings but did not solved the problem. In dbgprint file i saw that hyperion identified timestamp column (B) as ColType 0. Is it normal for timestamp column? Because when i look at the column properties in Reporting Studio, i see nothing in Item Type.
SELECT DISTINCT COLUMN_NAME, '*', COLUMN_ID, DATA_TYPE, DATA_LENGTH,
DATA_SCALE, DATA_PRECISION, NULLABLE, '*' FROM SYS.ALL_TAB_COLUMNS
WHERE TABLE_NAME = 'ERKAN_DENE' AND OWNER = 'DISBANK' ORDER BY
COLUMN_ID
Server Column Information
ColName ColNum ColType Length Places Digits Nulls
======= ====== ======== ====== ====== ====== =====
A 1 NUMBER 22 0 10 0
B 2 TIMESTAMP(6) 11 6 10 1
End Select
DaMgr DMTable Column Information
ColName ColNum ColType Length Places
======= ====== ====== ====== ======
A 0 4 22 0
B 1 0 11 6
Begin Executing Document OnPreProcess Script.
End Executing Document OnPreProcess Script.
Begin Select
(0 0 )
Sending SQL to the Server:
SELECT AL1.B FROM DISBANK.ERKAN_DENE AL1
Oracle error -1 3106: ORA-03106: fatal two-task communication protocol error
Exception thrown in v1_bi_code\bl\da\dasnet_l.cpp, line 959: Oracle Error -1: ORA-03106: fatal two-task communication protocol error
DaSession::CancelOk()
Regards,
Erkan -
Oracle evolution suggestion : NULL and Index
Hello,
As you know in most of case NULL values are not indexed and then not searchable using index.
Then when you do where MyField is null, you have the risk of doing a full table scan
However most of people don't know that, and then doesn't care of this possible issue and of possible solution (bitmap or including a not null column)
SQL Server, MySQL and probably some others DB don't have the same behavior as they indexes NULL
I know this caveat can be used to have partial indexing by nulling non interesting values and then can't be removed
Then I would suggest to enhance the create index command to allow to index also null with something like that
Create index MyIndex on MyTable(MyColumn including nulls )
As you make this change, perhaps it would be geat to change the behavior documented bellow as it looks more as an old heritage too by adding keyword like "allow null duplicate" and "constraint on null duplicate"
Ascending unique indexes allow multiple NULL values. However, in descending unique indexes, multiple NULL values are treated as duplicate values and therefore are not permitted.
LaurentHello,
Thanks, for the links it cover mains solutions to index null values, there's also the usage of bitmap index.
All of them are not very intuitive for an non expert.
But the purpose of my message was mainly to higlight this complexity for a quite basic stuff, as I think that the default solution should be to index nulls and eventually allow to do not index them.
As I said this is the behavior on sql server and mysql. That why i suggest to enhance index behavior to allow to index nulls easily and not by using stange tips like indexing a blank space or a not null column.
This solutions are from my viewpoint workaround, helpfull workaround but still workaround, Oracle database team have the power to change this root cause without breaking ascending compatibility, here is the sense of my message, just hopping they can hear me...
Laurent -
Oracle.security.jazn.JAZNRuntimeException: Invalid index
Hi all,
I'm getting this exception very often:
oracle.security.jazn.JAZNRuntimeException: Invalid index
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:480)
at com.evermind[Oracle Containers for J2EE 11g (11.1.1.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:583)
at com.evermind[Oracle Containers for J2EE 11g (11.1.1.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:334)
at com.evermind[Oracle Containers for J2EE 11g (11.1.1.0.0) ].server.http.HttpRequestHandler.doDispatchRequest(HttpRequestHandler.java:942)
at com.evermind[Oracle Containers for J2EE 11g (11.1.1.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:843)
at com.evermind[Oracle Containers for J2EE 11g (11.1.1.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:658)
at com.evermind[Oracle Containers for J2EE 11g (11.1.1.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:626)
at com.evermind[Oracle Containers for J2EE 11g (11.1.1.0.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:417)
at com.evermind[Oracle Containers for J2EE 11g (11.1.1.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:189)
at com.evermind[Oracle Containers for J2EE 11g (11.1.1.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:163)
at oracle.oc4j.network.ServerSocketReadHandler$ClientRunnable.run(ServerSocketReadHandler.java:275)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:237)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:29)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:877)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalStateException: Invalid index
at org.apache.myfaces.trinidad.bean.util.StateUtils.restoreKey(StateUtils.java:68)
at org.apache.myfaces.trinidad.bean.util.StateUtils.restoreState(StateUtils.java:142)
at org.apache.myfaces.trinidad.bean.util.FlaggedPropertyMap.restoreState(FlaggedPropertyMap.java:194)
at org.apache.myfaces.trinidad.bean.FacesBeanImpl.restoreState(FacesBeanImpl.java:342)
at org.apache.myfaces.trinidad.component.UIXComponentBase.restoreState(UIXComponentBase.java:898)
at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeState.java:57)
at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:872)
at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeState.java:96)
at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:872)
at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeState.java:96)
at org.apache.myfaces.trinidad.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:872)
at org.apache.myfaces.trinidad.component.TreeState.restoreState(TreeState.java:96)...{code}
Usualy when I click on refresh button on browser and in many other cases that I can't recognize as some rule...
Thanks in advance,
s o v i e tHi Frank!
This error occur for me when I have "pending" PPR and I start a new one (e.g. fast clicking same button twice). Also, it may happen when I have pending lazy fetching of some table or graph and I hit some action button, or when I refresh a page using browser refresh button (while PPR is still not finished).
And I notice that it doesn't occur when I don't use ADF Controller.
I have not found cause nor workaround, expect to keep users patient until the PPR is finished (blocking attribute is not working in TP4, and your very nice glasspane trick is not appropriate for each and every button click).
Regards,
PaKo -
Help with creating oracle text index on 2 columns with partial html data
Hi,
I need to create an oracle text index on 2 columns.
TITLE - varchar(255) = contains plain text data
DESCRIPTION - CLOB = contains partial HTML data
This is what I created.
begin
ctx_ddl.create_preference ('Title_Description_Pref', 'MULTI_COLUMN_DATASTORE');
ctx_ddl.set_attribute('Title_Description_Pref', 'columns', 'TITLE, DESCRIPTION');
end;
begin
ctx_ddl.create_preference ('bid_lexer', 'BASIC_LEXER');
ctx_ddl.set_attribute('bid_lexer', 'index_stems', 'ENGLISH');
ctx_ddl.create_section_group('htmgroup', 'HTML_SECTION_GROUP');
end;
create index Bid_Title_Index on Bid(title) indextype is ctxsys.context parameters ('LEXER bid_lexer sync (every "sysdate+(1/24)")');
create index Bid_Title_Desc_Index on Bid(description) indextype is ctxsys.context parameters ('LEXER bid_lexer DATASTORE Title_Description_Pref sync (every "sysdate+(1/24)") filter ctxsys.null_filter section group htmgroup');
The problem is when I do a CONTAINS(description, '$(auction)')>0. I get results where the descriptions have the "auction" word (which is correct). But, the results also returned rows where the search word is inside an IMG tag. e.g. <img src="http://auction.de/120483" alt="Auction Logo"/>.
What I would like is to exclude rows where the search word is inside HTML tag attributes, results expected are rows having <a>Auction</a> or <p>For Auction</p> ... etc. Basically stripping the html tags and leave the text contents.
I'd appreciate some input.
Thanks,
AmielHi,
I need to create an oracle text index on 2 columns.
TITLE - varchar(255) = contains plain text data
DESCRIPTION - CLOB = contains partial HTML data
This is what I created.
begin
ctx_ddl.create_preference ('Title_Description_Pref', 'MULTI_COLUMN_DATASTORE');
ctx_ddl.set_attribute('Title_Description_Pref', 'columns', 'TITLE, DESCRIPTION');
end;
begin
ctx_ddl.create_preference ('bid_lexer', 'BASIC_LEXER');
ctx_ddl.set_attribute('bid_lexer', 'index_stems', 'ENGLISH');
ctx_ddl.create_section_group('htmgroup', 'HTML_SECTION_GROUP');
end;
create index Bid_Title_Index on Bid(title) indextype is ctxsys.context parameters ('LEXER bid_lexer sync (every "sysdate+(1/24)")');
create index Bid_Title_Desc_Index on Bid(description) indextype is ctxsys.context parameters ('LEXER bid_lexer DATASTORE Title_Description_Pref sync (every "sysdate+(1/24)") filter ctxsys.null_filter section group htmgroup');
The problem is when I do a CONTAINS(description, '$(auction)')>0. I get results where the descriptions have the "auction" word (which is correct). But, the results also returned rows where the search word is inside an IMG tag. e.g. <img src="http://auction.de/120483" alt="Auction Logo"/>.
What I would like is to exclude rows where the search word is inside HTML tag attributes, results expected are rows having <a>Auction</a> or <p>For Auction</p> ... etc. Basically stripping the html tags and leave the text contents.
I'd appreciate some input.
Thanks,
Amiel -
Index on multiple columns issue Oracle 9i
Hi,
I have a couple of issues and would appreciate it if anyone can help:
a). I have a table that has indexes on multiple columns, so for example:
Index 1 on Org_Type, Org_Id and Effdt
Index 2 on FICE_CD, Org_Id and Effdt etc.
I have 9 such indexes and all of them hav Effdt in it.
My question is if I query the table and always use a subquery to get the max Effdt rows form the table, will the above indexes help in my query or will I have to create another index just on Effdt so that my Query runs faster.
b). I have a target table with more than 20 million rows in it. This table has an Effdt too and I would like to find the max effdted row in this table as well so that I can then use that date-time stamp in my ETL tool to do an incremental update from my source table each night. But since the amount of rows is huge, my query runs forever. I have a normal non-unique index on Effdt. Is there another way I can optimize this table? Currenlty I have resorted to getting all rows from source that are >= (sysdate -1), but I would prefer to get the max date-time stamp from the target table itself.
Thanks,
CJHi ,
Thanks for the input. I just used the explain plan and found that there is a full table scan happening on the PS_EXT_ORG_TBL, so I guess I will have to create an index specifically on the effdt field. The sql is as follows:
Select E.EMPLID, E.INSTITUTION, E.EXT_ORG_ID, E.EXT_CAREER, E.EXT_DATA_NBR, E.EXT_SUMM_TYPE, E.UNT_ATMP_TOTAL, E.UNT_COMP_TOTAL,
E.CLASS_RANK, E.CLASS_SIZE, E.PERCENTILE, E.UM_GPA_EXCLUDE, E.UM_EXT_ORG_GPA, E.CONVERT_GPA,
E.UM_EXT_ORG_CNV_CR, E.UM_EXT_ORG_CNV_GPA, E.UM_EXT_ORG_CNV_QP, E.UM_GPA_OVERRIDE, E.EXT_ACAD_LEVEL,
F.FROM_DT, F.TO_DT, G.EXT_DEGREE_NBR, G.DEGREE, G.DESCR "DEGREE DESCR", G.DEGREE_DT, H.EFFDT,
H.EFF_STATUS, H.SCHOOL_CODE, H.LS_SCHOOL_TYPE, H.ATP_CD, H.CITY, H.STATE, H.COUNTRY,
H.DESCR "SCHOOL DESCR", H.PROPRIETORSHIP
FROM PS_EXT_ACAD_SUM E, PS_EXT_ACAD_DATA F, PS_EXT_DEGREE G, PS_EXT_ORG_TBL H
WHERE E.EXT_ORG_ID = F.EXT_ORG_ID AND E.EMPLID = F.EMPLID
AND E.EXT_ORG_ID = G.EXT_ORG_ID AND E.EMPLID = G.EMPLID
AND E.EXT_ORG_ID = H.EXT_ORG_ID
AND H.EFFDT=(SELECT MAX(EFFDT) FROM PS_EXT_ORG_TBL H1
WHERE H.EXT_ORG_ID=H1.EXT_ORG_ID
AND H.EFF_STATUS=H1.EFF_STATUS
AND H.SCHOOL_CODE=H1.SCHOOL_CODE
AND H.LS_SCHOOL_TYPE=H1.LS_SCHOOL_TYPE
AND H.ATP_CD=H1.ATP_CD
AND H.CITY=H1.CITY
AND H.STATE=H1.STATE )
My source DB is a copy of the transactional database, so there is no danger of new rows coming in. -
Do ORACLE support indexing on the columns with Hebrew Data
Hello Forum,
I was working on an assignment with schemas containing Hebrew Data.
Can i create indexes on the columns containing Hebrew Language data?
Thanks
Priyank JainVarchar2; is something difficult for me. Reason why is I need to make change in my application throughout to accept this design change.
My need of Index on Hebrew Data:
Basically I am going to implement a Full-Text Search environment. For full-text searching; I am having a plugin which implements Lucene Algorithm of Indexing.
The Index writing will not be useful until the table is indexed and well-functional.
"But note that standard indexes will be sorted according to binary order of Hebrew letters in Unicode."
So does it means we are not going to index on actual data (Data in Hebrew)??
Thanks
Priyank Jain -
Function Based Index on Date Column
Hi All,
I need to execute a query like this :
SELECT * FROM ORDERS WHERE APPROVE_DATE IS NULL
I read anywhere that this will cause unnecessary FTS so that I should create function based index.
I have tried one below , but not sure that this is correct approach :
CREATE INDEX idx_1
ON ORDERS (NVL(APPROVE_DATE, '01-JAN-1900'));
SELECT * FROM ORDERS WHERE NVL(APPROVE_DATE, '01-JAN-1900') = '01-JAN-1900'
Is this a correct approach ?
Thank you,
xtantoA SQL_TRACE output will explain clearly what Justin has stated.
I have created a table T based on all_objects.
SQL> desc t
Name Null? Type
OWNER NOT NULL VARCHAR2(30)
OBJECT_NAME NOT NULL VARCHAR2(30)
SUBOBJECT_NAME VARCHAR2(30)
OBJECT_ID NOT NULL NUMBER
DATA_OBJECT_ID NUMBER
OBJECT_TYPE VARCHAR2(19)
CREATED DATE
LAST_DDL_TIME NOT NULL DATE
TIMESTAMP VARCHAR2(19)
STATUS VARCHAR2(7)
TEMPORARY VARCHAR2(1)
GENERATED VARCHAR2(1)
SECONDARY VARCHAR2(1)
CASE I_
SQL> select count(1) from t
2 /
COUNT(1)
934320
SQL> select count(1) from t where created is null
2 /
COUNT(1)
2376The number of null values in CREATED column is proportionately very small.
Now i execute the query without function based index.
select *
from t
where created is null
call count cpu elapsed disk query current rows
Parse 1 0.00 0.09 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 160 0.04 0.10 0 12662 0 2376
total 162 0.04 0.19 0 12662 0 2376
Rows Execution Plan
0 SELECT STATEMENT GOAL: ALL_ROWS
2376 TABLE ACCESS GOAL: ANALYZED (FULL) OF 'T' (TABLE)And here is the query that uses the function based index
select *
from t
where nvl(created,to_date('01-01-1900','DD-MM-YYYY')) = to_date('01-01-1900','DD-MM-YYYY')
call count cpu elapsed disk query current rows
Parse 1 0.01 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 160 0.01 0.01 0 698 0 2376
total 162 0.03 0.01 0 698 0 2376
Rows Execution Plan
0 SELECT STATEMENT GOAL: ALL_ROWS
2376 TABLE ACCESS GOAL: ANALYZED (BY INDEX ROWID) OF 'T' (TABLE)
2376 INDEX GOAL: ANALYZED (RANGE SCAN) OF 'T_FN_IDX' (INDEX)Its very obvious from the above output that the Function Based Index as increased the performance.
CASE II_
SQL> select count(1) from t
2 /
COUNT(1)
934320
SQL> select count(1) from t where created is null
2 /
COUNT(1)
202168Now the null values in the CREATED column is proportionately large than the first test case.
Now lets see without using the function based index
select *
from t
where created is null
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 13479 0.46 0.71 2 25832 0 202168
total 13481 0.46 0.71 2 25832 0 202168
Rows Execution Plan
0 SELECT STATEMENT GOAL: ALL_ROWS
202168 TABLE ACCESS GOAL: ANALYZED (FULL) OF 'T' (TABLE)Now iam trying to use the function based index
select *
from t
where nvl(created,to_date('01-01-1900','DD-MM-YYYY')) = to_date('01-01-1900','DD-MM-YYYY')
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 13479 0.54 0.84 0 33826 0 202168
total 13481 0.54 0.84 0 33826 0 202168
Rows Execution Plan
0 SELECT STATEMENT GOAL: ALL_ROWS
202168 TABLE ACCESS GOAL: ANALYZED (FULL) OF 'T' (TABLE)Its obvious from the result that oracle has decided to go for a FULL TABLE SCAN even when an index was available.
So just having a function based index is not going to increase the query performance. There are lot of other factors to be considered as stated above.
Thanks,
Karthick. -
Index issue with or and between when we set one partition index to unusable
Need to understand why optimizer unable to use index in case of "OR" whenn we set one partition index to unusable, the same query with between uses index.
“OR” condition fetch less data comparing to “BETWEEN” still oracle optimizer unable to use indexes in case of “OR”
1. Created local index on partitioned table
2. ndex partition t_dec_2009 set to unusable
-- Partitioned local Index behavior with “OR” and with “BETWEEN”
SQL> CREATE TABLE t (
2 id NUMBER NOT NULL,
3 d DATE NOT NULL,
4 n NUMBER NOT NULL,
5 pad VARCHAR2(4000) NOT NULL
6 )
7 PARTITION BY RANGE (d) (
8 PARTITION t_jan_2009 VALUES LESS THAN (to_date('2009-02-01','yyyy-mm-dd')),
9 PARTITION t_feb_2009 VALUES LESS THAN (to_date('2009-03-01','yyyy-mm-dd')),
10 PARTITION t_mar_2009 VALUES LESS THAN (to_date('2009-04-01','yyyy-mm-dd')),
11 PARTITION t_apr_2009 VALUES LESS THAN (to_date('2009-05-01','yyyy-mm-dd')),
12 PARTITION t_may_2009 VALUES LESS THAN (to_date('2009-06-01','yyyy-mm-dd')),
13 PARTITION t_jun_2009 VALUES LESS THAN (to_date('2009-07-01','yyyy-mm-dd')),
14 PARTITION t_jul_2009 VALUES LESS THAN (to_date('2009-08-01','yyyy-mm-dd')),
15 PARTITION t_aug_2009 VALUES LESS THAN (to_date('2009-09-01','yyyy-mm-dd')),
16 PARTITION t_sep_2009 VALUES LESS THAN (to_date('2009-10-01','yyyy-mm-dd')),
17 PARTITION t_oct_2009 VALUES LESS THAN (to_date('2009-11-01','yyyy-mm-dd')),
18 PARTITION t_nov_2009 VALUES LESS THAN (to_date('2009-12-01','yyyy-mm-dd')),
19 PARTITION t_dec_2009 VALUES LESS THAN (to_date('2010-01-01','yyyy-mm-dd'))
20 );
SQL> INSERT INTO t
2 SELECT rownum, to_date('2009-01-01','yyyy-mm-dd')+rownum/274, mod(rownum,11), rpad('*',100,'*')
3 FROM dual
4 CONNECT BY level <= 100000;
SQL> CREATE INDEX i ON t (d) LOCAL;
SQL> execute dbms_stats.gather_table_stats(user,'T')
-- Mark partition t_dec_2009 to unusable:
SQL> ALTER INDEX i MODIFY PARTITION t_dec_2009 UNUSABLE;
--- Let’s check whether the usable index partition can be used to apply a restriction: BETWEEN
SQL> SELECT count(d)
FROM t
WHERE d BETWEEN to_date('2009-01-01 23:00:00','yyyy-mm-dd hh24:mi:ss')
AND to_date('2009-02-02 01:00:00','yyyy-mm-dd hh24:mi:ss');
SQL> SELECT * FROM table(dbms_xplan.display_cursor(format=>'basic +partition'));
| Id | Operation | Name | Pstart| Pstop |
| 0 | SELECT STATEMENT | | | |
| 1 | SORT AGGREGATE | | | |
| 2 | PARTITION RANGE SINGLE| | 12 | 12 |
| 3 | INDEX RANGE SCAN | I | 12 | 12 |
--- Let’s check whether the usable index partition can be used to apply a restriction: OR
SQL> SELECT count(d)
FROM t
WHERE
(d >= to_date('2009-01-01 23:00:00','yyyy-mm-dd hh24:mi:ss') and d <= to_date('2009-01-01 23:59:59','yyyy-mm-dd hh24:mi:ss'))
or
(d >= to_date('2009-02-02 01:00:00','yyyy-mm-dd hh24:mi:ss') and d <= to_date('2009-02-02 02:00:00','yyyy-mm-dd hh24:mi:ss'))
SQL> SELECT * FROM table(dbms_xplan.display_cursor(format=>'basic +partition'));
| Id | Operation | Name | Pstart| Pstop |
| 0 | SELECT STATEMENT | | | |
| 1 | SORT AGGREGATE | | | |
| 2 | PARTITION RANGE OR| |KEY(OR)|KEY(OR)|
| 3 | TABLE ACCESS FULL| T |KEY(OR)|KEY(OR)|
----------------------------------------------------“OR” condition fetch less data comparing to “BETWEEN” still oracle optimizer unable to use indexes in case of “OR”
Regards,
Sachin B.Hi,
What is your database version????
I ran the same test and optimizer was able to pick the index for both the queries.
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL>
SQL> set autotrace traceonly exp
SQL>
SQL>
SQL> SELECT count(d)
2 FROM t
3 WHERE d BETWEEN to_date('2009-01-01 23:00:00','yyyy-mm-dd hh24:mi:ss')
4 AND to_date('2009-02-02 01:00:00','yyyy-mm-dd hh24:mi:ss');
Execution Plan
Plan hash value: 2381380216
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
| 0 | SELECT STATEMENT | | 1 | 8 | 25 (0)| 00:00:01 | | |
| 1 | SORT AGGREGATE | | 1 | 8 | | | | |
| 2 | PARTITION RANGE ITERATOR| | 8520 | 68160 | 25 (0)| 00:00:01 | 1 | 2 |
|* 3 | INDEX RANGE SCAN | I | 8520 | 68160 | 25 (0)| 00:00:01 | 1 | 2 |
Predicate Information (identified by operation id):
3 - access("D">=TO_DATE(' 2009-01-01 23:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
"D"<=TO_DATE(' 2009-02-02 01:00:00', 'syyyy-mm-dd hh24:mi:ss'))
SQL> SELECT count(d)
2 FROM t
3 WHERE
4 (
5 (d >= to_date('2009-01-01 23:00:00','yyyy-mm-dd hh24:mi:ss') and d <= to_date('2009-01-01 23:59:59','yyyy-mm-dd hh24:mi:ss'
6 or
7 (d >= to_date('2009-02-02 01:00:00','yyyy-mm-dd hh24:mi:ss') and d <= to_date('2009-02-02 02:00:00','yyyy-mm-dd hh24:mi:ss'
8 );
Execution Plan
Plan hash value: 3795917108
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
| 0 | SELECT STATEMENT | | 1 | 8 | 4 (0)| 00:00:01 | | |
| 1 | SORT AGGREGATE | | 1 | 8 | | | | |
| 2 | CONCATENATION | | | | | | | |
| 3 | PARTITION RANGE SINGLE| | 13 | 104 | 2 (0)| 00:00:01 | 2 | 2 |
|* 4 | INDEX RANGE SCAN | I | 13 | 104 | 2 (0)| 00:00:01 | 2 | 2 |
| 5 | PARTITION RANGE SINGLE| | 13 | 104 | 2 (0)| 00:00:01 | 1 | 1 |
|* 6 | INDEX RANGE SCAN | I | 13 | 104 | 2 (0)| 00:00:01 | 1 | 1 |
Predicate Information (identified by operation id):
4 - access("D">=TO_DATE(' 2009-02-02 01:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
"D"<=TO_DATE(' 2009-02-02 02:00:00', 'syyyy-mm-dd hh24:mi:ss'))
6 - access("D">=TO_DATE(' 2009-01-01 23:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
"D"<=TO_DATE(' 2009-01-01 23:59:59', 'syyyy-mm-dd hh24:mi:ss'))
filter(LNNVL("D"<=TO_DATE(' 2009-02-02 02:00:00', 'syyyy-mm-dd hh24:mi:ss')) OR
LNNVL("D">=TO_DATE(' 2009-02-02 01:00:00', 'syyyy-mm-dd hh24:mi:ss')))
SQL> set autotrace off
SQL>Asif Momen
http://momendba.blogspot.com -
Oracle EPM Planning 11.1.2.1 - Ziplogs utility not working on all servers
Oracle EPM Planning 11.1.2.1 - Ziplogs utility not working on all servers
We have Planning 11.1.2.1 distributed so that Planning web app, EAS etc. are on own webservers and Essbase is on separate cluster.
Currently we have an issue with ziplogs utility - it seems to work on Essbase servers gathering all necessary ODL logs for over 100MBs, but on Planning Webservers ziplogs utility seems to start, but generates only empty 1kb zip file without any content.
We haven't touched logging otherwise, everything should be pretty much in original state.
Unfortunately I can't remember now exactly, but I have a a hunch that ziplogs utility worked prior patching Planning element on webservers to 11.1.2.1.600.
Other servers or elements haven't been patched (although Oracle recommends also FS, EB etc. to be patched to 11.1.2.1.600). I'm wondering, could this be the reason as in a way FS and EB are on same patching level whereas Planning is not?
Also, there seems to be a bit of limited diskspace on webservers (still waiting for extension), but I would imagine lack of diskspace for preparing any temp files etc. would results in some errors, the problem is that ziplogs doesn't give any errors, just runs very short time and then ends bringing 1kb empty file.
Has anyone experienced anything similar and are you perhaps able to give quick guidance how to enhance or modify ziplogs batch file etc. to make it create a bit of logging of its own actions?
Thanks in advance if anyone has ideas what could be the root cause for this or faced something similar.Okay, I was able to get it installed and Common Components installed correctly this time. I still can't access workspace though.
Is there something I need to do before I can browse to http://localhost:19000/workspace/index.jsp?
All I get is the following error:
Error 404--Not Found
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.5 404 Not Found
The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.
Anyone know what's going on? -
How to create a domain index on NCLOB Column
hi all,
My database version is 10.2.0.1.
Any body know how to create a domain index on nclob column.
SQL> alter table test add (nclob1 nclob);
Table altered.
SQL> CREATE INDEX test_nclob ON test (nclob1) indextype is ctxsys.context
2 /
CREATE INDEX test_nclob ON test (nclob1) indextype is ctxsys.context
ERROR at line 1:
ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-20000: Oracle Text error:
DRG-10509: invalid text column: NCLOB1
ORA-06512: at "CTXSYS.DRUE", line 160
ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 364Regards
SinghAny body know how to create a domain index on nclob columnNot possible per design/documentation:
The column that you specify must be one of the following types: CHAR, VARCHAR, VARCHAR2, BLOB, CLOB, BFILE, XMLType, or URIType.
« -
Can we put INDEXES on Views if not Is there any way to make it Index bas
Hi
I am running a query in which there are several views involved in the join condition Can we put INDEXES on Views in ORACLE 9i if not Is there any way to make it Index based views beacuse the result that i am getting is very slow and is eating like 10gb of the temp tablespace.
ThanksNo, you cannot put indexes on a view. Think about what a view is, a stored sql statement. Oracle has no way of knowing what rows are in a view until it actually runs the view. So, even if you could, Oracle would need to run the view to get the rows, build the index, then run your query a second time using the index. Seems counter productive to me. A view can use indexes on the underlying tables if appropriate.
Generally speaking, I would say that a query that makes use of multiple views is probably really inefficient. Often, you are only looking for one or two columns from a view which may require joining several tables whose columns are of no use in the main query. I would start by re-writing the query using the base tables, and only using those tables that are actually required to answer the question.
TTFN
John
Maybe you are looking for
-
How can I get an image from the screen? Like screen printer in PC to pasting after in word or other program.
-
Anyone having problems listening to iTunes radio?
I can listen to 2 or 3 songs then it just pauses out. It used to be a joy to listen to but not any more.
-
MRP Wizard: Preferred Vendor
Hi, our customer is very unhappy to not have the ability to select a Preferred Vendor in MRP Wizard to filter the items. He want's to know what he has to purchase at his vendor via MRP. For this, he need this ability. Please check thsi! Best regards,
-
Quick iTunes Q. :)
Hi Folks, Very quick question. My Mac crashed before, I had to re-install OSX (no big shakes). My iTunes library lives on an external firewire hard drive. Now that I'm back up and running, I went to iTunes and told it where my library was. Now, how d
-
The SYSTEM SOUNDS stays low and will not get loud like the speakers will. The system sounds volume is adjustable but, only in low volume magnitude. How do I get the system sound to equal the speakers? I tried the mixer and the system sounds still won