SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle Text 12c New Features
Ulrike Schwinn
Business Unit Database
Oracle Deutschland B.V. & Co KG
Deutschsprachiger Oracle Text Blog (@cczarski und @uschwinn)
http://oracle-text-de.blogspot.de/
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
New Features im Überblick
• Performance
– Erhöhung von MAX_INDEX_MEMORY
– Near Real Time Index
– BIG_IO
– Separate Offsets
– Query Result Cache
– Pattern Stopclass
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
New Features im Überblick
• Document Service
– Forward und Save Copy Index
– Snippets für Result Set Interface
• Abfragen
– Neue und erweiterte Operatoren
– SDATA Erweiterungen
– Änderungen an Datastore Trigger
• Internationalisierung
– Document Lexer
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
MAX_INDEX_MEMORY
• Performance beim Anlegen, Verändern und Optimierung des Index
– Memory Verwendung so hoch wie möglich setzen
• Erhöhung von MAX_INDEX_MEMORY in 12c auf 256 GB (statt 2GB vorher)
• Möglich mit CTX_ADM oder CREATE/ALTER INDEX Kommando
• Sample Code:
http://oracle-text-de.blogspot.de/2009/04/index-optimierung-einige-grundlagen.html
execute ctx_adm.set_parameter('MAX_INDEX_MEMORY', '256G')
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Near Real Time Index
• Anforderung: Index möglich aktuell halten - sogar bei hoher Änderungsrate
– Problem: Häufiges Synchronisieren führt zu Fragmentierung
• Neu: Near real-time Index oder two level Index
– Kleiner Stage Index im Memory und danach Merge in den Hauptindex
• Nutze neue Option “STAGE_ITAB” für Storage Preference
– Neue Tabelle $G und Index $H
• Sample Code: stage_itab.sql, auto_opt.sql
http://oracle-text-de.blogspot.de/2013/10/oracle-text-in-oracle-12c-automatic.html
Aktualität Fragmentierung
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Near Real Time Index - Beispiel
• Preference anlegen
• Optional: Cachen im KEEP Pool
• Index anlegen
exec ctx_ddl.create_preference('my_storage', 'BASIC_STORAGE')
exec ctx_ddl.set_attribute('my_storage', 'STAGE_ITAB', 'true')
exec ctx_ddl.set_attribute('my_storage','G_TABLE_CLAUSE', 'storage (buffer_pool keep)')
exec ctx_ddl.set_attribute('my_storage','G_INDEX_CLAUSE', 'storage (buffer_pool keep)')
create index my_index on my_table(text) indextype is ctxsys.context
parameters('storage my_storage sync (on commit)')
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Near Real Time Index - Beispiel
insert into my_table values( 1, 'hello world' );
insert into my_table values( 2, 'goodbye world' );
commit;
SQL> select token_text from dr$my_index$g;
TOKEN_TEXT
----------------------------------------------------------------
GOODBYE
HELLO
WORLD
SQL> select token_text from dr$my_index$i;
no rows selected
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Near Real Time Index - Merge
• Manuell
• Automatisch über Scheduler Job
execute ctx_ddl.optimize_index(idx_name=>'MY_INDEX', optlevel=>'MERGE')
exec ctx_ddl.add_auto_optimize( 'my_index' )
select job_name, program_name, last_start_date
from dba_scheduler_jobs where owner='CTXSYS‘;
JOB_NAME PROGRAM_NAME
-------------------- --------------------
LAST_START_DATE
----------------------------------------------------------------------
DR$BGOPTJOB DR$BGOPTPRG
01-JUN-15 09.32.48.660822 AM EUROPE/VIENNA
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Optimierung von TOKEN_INFO mit “BIG_IO”
• In 11g: $I Tabelle mit TOKEN_INFO ist optimiert für BLOB mit 4000 Byte
Chunks (Inline Storage)
• In 12c: Nutzung von Securefiles mit großen Chunks => Reduzierung von
Random I/O bei großen Indexeinträgen
Name Null? Type
----------------- -------- ------------
TOKEN_TEXT NOT NULL VARCHAR2(64)
TOKEN_TYPE NOT NULL NUMBER(3)
TOKEN_FIRST NOT NULL NUMBER(10)
TOKEN_LAST NOT NULL NUMBER(10)
TOKEN_COUNT NOT NULL NUMBER(10)
TOKEN_INFO BLOB
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Optimierung von TOKEN_INFO mit “BIG_IO”
• Realisierung über neue Storage Preference BIG_IO
• Sample Code: big_io.sql, big_io_test.sql
http://oracle-text-de.blogspot.in/2015/06/12c-feature-i-tabelle-mit-neuer-storage.html
exec ctx_ddl.create_preference('my_storage', 'BASIC_STORAGE' )
exec ctx_ddl.set_attribute('my_storage', 'BIG_IO', 'true' )
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Optimierung von TOKEN_INFO mit „separate Offsets“
• TOKEN_INFO besteht aus DOCID und OFFSET Informationen
Oracle Confidential – 1
1001 Nacht und Tag, Tag und Nacht
1002 Es war eine stürmische Nacht
NACHT (DOCID 1, INFO 1,2)(DOCID 2, INFO 3)
TAG (DOCID 1, INFO 4,5)
STÜRMISCHE (DOCID 2, INFO 6)
TOKEN_TEXT TOKEN_INFO (BLOB)
ID TEXT
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Optimierung von TOKEN_INFO mit “Separate Offsets”
• Problematik: Offset Daten können groß werden
• Wann überhaupt Offset Informationen?
– Notwendig für Phrasen, NEAR und Zone Section Abfragen
– NICHT notwendig für Single Term Abfragen, Boolean oder Score Suche, bei AND, OR,
NOT, MINUS und FIELD Suche
Neu in 12c: DOCID und Token Offsets können in separaten Spalten
abgelegt werden
• Sample Code: separate_offsets.sql
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Optimierung von TOKEN_INFO mit “Separate Offsets”
• Neue Option SEPARATE_OFFSETS
exec ctx_ddl.create_preference( 'my_storage', 'BASIC_STORAGE' )
exec ctx_ddl.set_attribute ( 'my_storage', 'SEPARATE_OFFSETS', 'true' )
describe dr$my_index$i
Name Null? Type
----------------------------------------- -------- ----------------------
TOKEN_TEXT NOT NULL VARCHAR2(64)
TOKEN_TYPE NOT NULL NUMBER(10)
TOKEN_FIRST NOT NULL NUMBER(10)
TOKEN_LAST NOT NULL NUMBER(10)
TOKEN_COUNT NOT NULL NUMBER(10)
TOKEN_INFO BLOB
TOKEN_OFFSETS BLOB
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Performance mit Forward und Save Copy Index
• Problem: Snippets und Highlight Operationen sind langsam, da das ganze
Dokument noch einmal ”processed” werden muss
• Lösung:
– Kopie als Forward Index in neue Tabelle $O
– “Save Copy” Ablage in neue Tabelle $D (zusätzlich Compressed, Tokinized mit
Stopwörtern, als Plaintext oder gefiltert)
• Sample Code: forward_index.sql, snippets.sql
http://oracle-text-de.blogspot.de/2015/02/schnellere-text-abfragen-mit-snippet-in.html
exec ctx_ddl.create_preference( 'my_store', 'BASIC_STORAGE' )
exec ctx_ddl.set_attribute ( 'my_store', 'FORWARD_INDEX', 'TRUE' )
exec ctx_ddl.set_attribute ( 'my_store', 'SAVE_COPY', 'PLAINTEXT' )
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Spezieller Ergebniscache für Text-Abfragen
• Ähnlich wie bei Query Result Cache: spezieller Bereich für sich
wiederholende Resultate
• Gut geeignet für nachträgliches Filtern von Ergebnissen
• Neue Storage Option QUERY_FILTER_CACHE_SIZE
• Neue Operator CTXFILTERCACHE mit zusätzlichen Optionen wie “save
score” oder nur “top N by score”
execute ctx_ddl.create_preference('my_i_storage', 'basic_storage');
execute ctx_ddl.set_attribute('my_i_storage','query_filter_cache_size', '10M');
ctxfiltercache((query_text) [, save_score] [, topN])
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Spezieller Ergebniscache für Text-Abfragen - Beispiele
select * from texttabelle where contains(dokument,
'ctxfiltercache((Obama), true, true)
and sdata(ressort = ''Politik'')' ) > 0;
exec ctx_query.store_sqe( 'securityclause1', '( john within secusers or
sales within secgroups )', ctx_query.DURATION_SESSION);
select * from my_table where contains(text,
'fox and SQE(securityclause1)') > 0;
select * from my_table where contains( text,
'fox and ctxfiltercache( (SQE(securityclause1)) )') > 0;
• Auch mit neuem Feature Session Duration Stored Query Expressions (SQE)
• Sample code: query_filter_cache.sql
http://oracle-text-de.blogspot.de/2014/09/ergebniscache-fur-text-abfragen.html
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Operatoren: NEAR und MNOT
• NEAR Erweiterungen
– Nested NEAR; NEAR zusätzlich mit Ausdrücken
• MNOT (mild not) Operator
– Wörter, welche nicht Teil sind von …
• Sample Code: mnot.sql
SELECT * FROM docs WHERE CONTAINS(txt, 'near((near((term1, term2),5), term3),
100)')>0
select * from my_table where contains(text, 'york MNOT new york' ) > 0;
York is in Yorkshire, New York is in New York
York is a city in England
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Pattern Stopclass
• Definition von Stopwörtern mit “regular expression”
• Beispiele
– Keine Zahlen >= 5 Ziffern
– Keine langen Wörter >= 20 Zeichen
• Hinweis: Definition einer eigenen Stopliste ist erforderlich (nicht
anwendbar auf Default Listen)
• Sample Code: pattern_stopclass.sql
http://oracle-text-de.blogspot.de/2013/07/oracle-text-in-oracle12c-neues-feature.html
ctx_ddl.add_stopclass('stop', 'longwords', '[[:alnum:]]{20,}' )
exec ctx_ddl.add_stopclass('stop', 'fivedignums', '[[:digit:],.]{5,}')
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Languages und Lexer
• Neue CTX_DOC Prozedur policy_languages
– Liefert Liste der Sprachen für ein Dokument (vergleichbar mit AUTO_LEXER)
• Document Level Lexer
– Verschiedene Lexer für unterschiedliche Dokumente => Sprachen unabhängiger
Sublexer
– Basiert auf MULTI_LEXER Technologie
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
SDATA Erweiterungen
• Updatable SDATA Sections
– Synchrone Updates auf SDATA ohne Re-Indizierung
• Hinzufügen von SDATA Sektionen zum existierenden Index
– Kein Re-Create erforderlich
• Mehr SDATA Sektionen (Maximal 99)
– Maximum FILTER BY / ORDER BY noch bei 32
• Sample Code: sdata.sql
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
SDATA Erweiterungen
• Query Template kann nun nach SDATA sortieren
<query>
<textquery> digital and sdata(stocklevel > 4)
</textquery>
<order>
<orderkey> SDATA(stocklevel) desc </orderkey>
<orderkey> score desc </orderkey>
</order>
</query>
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Änderungen an Datastore Trigger
• Index auf verschiedenen Spalten mit MULTI_COLUMN_STORE und
USER_DATASTORE
– Normalerweise Verwendung von Triggern wie folgt
• In 12c wird nun der Status von allen Spalten überprüft! Trigger wirkt nur
wenn alle Spalten verändert wurden.
• Fix mit Session oder System Kommando
CREATE OR REPLACE TRIGGER customer_update_trg
BEFORE UPDATE OF lastname ON customers
FOR EACH ROW
BEGIN
:new.firstname := :new.firstname;
END;
alter session set "_fix_control"='14155722:OFF'
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Snippet Support in Result Set Interface
• Result Set Interface – XML Query Support seit 11g
– Result Set Descriptor (XML Block) beschreibt Resultate in einem (!) SQL Call
– Bereits für ROWIDs und SDATA Werte
• Ab 12c auch für Snippets
<ctx_result_set_descriptor>
<hitlist start_hit_num="1" end_hit_num="10" order="SCORE DESC">
<rowid />
<score />
<sdata name="title" />
<snippet radius="20" max_length="160" starttag="&lt;b&gt;"
endtag="&lt;/b&gt;" />
</hitlist>
<count />
</ctx_result_set_descriptor>
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
XQuery Text Unterstützung
• Volltextsuche im XML DB Framework
• “Universal Index” erlaubt das Mischen von strukturierten und
unstrukturierten Daten
• Nutze PATH SECTION Typ mit XML_ENABLE = 'true'
SELECT po.id
FROM PURCHASEORDER po
WHERE XMLExists
('$src/purchaseOrder/billingInstruction/Address
[. contains text {$PHRASE1}
ftand {$PHRASE2} using stemming] '
PASSING po.x, 'Science' as “PHRASE1”, 'Magdalen' as“PHRASE2”)
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
New Features im Überblick
• Performance
– Erhöhung von MAX_INDEX_MEMORY für mehr OPTIMIZE und CREATE Performance
– Near Real Time Index: Häufige Index Syncs ohne Fragmentierung
– BIG_IO: Neue Indexarchitektur reduziert Index Lookups bei großen Indexfragmenten
– Separate Offsets: Trennung der Offset Informationen in der Indexstruktur reduziert
I/O für Abfragen, in denen Wortpositionen nicht gebraucht wird
– Query Result Cache: Spezieller Ergebniscache
– Pattern Stopclass: reguläre Ausdrücke für Tokens, die nicht indiziert werden sollen
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
New Features im Überblick
• Document Service
– „Forward and Save Copy“ Index: mehr Performance für Snippet Operationen
– Snippets für Result Set Interface
• Abfragen
– Neue und erweiterte Operatoren
– SDATA Erweiterungen
• Internationalisierung
– Document Lexer
Copyright © 2014 Oracle and/or its affiliates. All rights reserved.
Informationen
• White Paper
– http://www.oracle.com/technetwork/database/information-
management/oracletext12cfeatures-1932547.pdf
• Sample Code auf OTN
– http://www.oracle.com/us/products/database/enterprise-
edition/12ctechnicaloverview-1961500.zip?ssSourceSiteId=otnen
• OTN mit Oracle Text
– http://www.oracle.com/technetwork/database/features/index-098492.html

Weitere ähnliche Inhalte

Andere mochten auch

Oracle application express ppt
Oracle application express pptOracle application express ppt
Oracle application express ppt
Abhinaw Kumar
 
Production Support
Production SupportProduction Support
Production Support
r_shanki
 
Scalable vertical search engine with hadoop
Scalable vertical search engine with hadoopScalable vertical search engine with hadoop
Scalable vertical search engine with hadoop
datasalt
 

Andere mochten auch (11)

 
How to build_a_search_engine
How to build_a_search_engineHow to build_a_search_engine
How to build_a_search_engine
 
document1-2 FINAL-FINALLL
document1-2 FINAL-FINALLLdocument1-2 FINAL-FINALLL
document1-2 FINAL-FINALLL
 
Oracle Application Express
Oracle Application ExpressOracle Application Express
Oracle Application Express
 
Oracle Text in APEX
Oracle Text in APEXOracle Text in APEX
Oracle Text in APEX
 
Oracle application express ppt
Oracle application express pptOracle application express ppt
Oracle application express ppt
 
Production Support
Production SupportProduction Support
Production Support
 
Amazon search test case document
Amazon search test case documentAmazon search test case document
Amazon search test case document
 
SEO Proposal Sample
SEO Proposal SampleSEO Proposal Sample
SEO Proposal Sample
 
IC Engine PPt
IC Engine PPtIC Engine PPt
IC Engine PPt
 
Scalable vertical search engine with hadoop
Scalable vertical search engine with hadoopScalable vertical search engine with hadoop
Scalable vertical search engine with hadoop
 

Ähnlich wie Oracle Text 12c New Features

Oracle workshop sessiontracing
Oracle workshop sessiontracingOracle workshop sessiontracing
Oracle workshop sessiontracing
ciganek
 

Ähnlich wie Oracle Text 12c New Features (20)

Ausgewählte PL/SQL Packages (2)
Ausgewählte PL/SQL Packages (2)Ausgewählte PL/SQL Packages (2)
Ausgewählte PL/SQL Packages (2)
 
Ausgewählte PL/SQL Packages (3)
Ausgewählte PL/SQL Packages (3)Ausgewählte PL/SQL Packages (3)
Ausgewählte PL/SQL Packages (3)
 
Oracle Database 12c Release 2
Oracle Database 12c Release 2 Oracle Database 12c Release 2
Oracle Database 12c Release 2
 
Überblick zu Oracle Database 12c Release 2
Überblick zu Oracle Database 12c Release 2Überblick zu Oracle Database 12c Release 2
Überblick zu Oracle Database 12c Release 2
 
Hybrid Partitioned Tables in Oracle Database 19c
Hybrid Partitioned Tables in Oracle Database 19cHybrid Partitioned Tables in Oracle Database 19c
Hybrid Partitioned Tables in Oracle Database 19c
 
18c: private temporary tables
18c: private temporary tables18c: private temporary tables
18c: private temporary tables
 
Oracle workshop sessiontracing
Oracle workshop sessiontracingOracle workshop sessiontracing
Oracle workshop sessiontracing
 
Oracle12c threaded execution - Ressourcen sparen zum Nulltarif?!?
Oracle12c threaded execution - Ressourcen sparen zum Nulltarif?!?Oracle12c threaded execution - Ressourcen sparen zum Nulltarif?!?
Oracle12c threaded execution - Ressourcen sparen zum Nulltarif?!?
 
20160310_ModernApplicationDevelopment_NoSQL_KPatenge
20160310_ModernApplicationDevelopment_NoSQL_KPatenge20160310_ModernApplicationDevelopment_NoSQL_KPatenge
20160310_ModernApplicationDevelopment_NoSQL_KPatenge
 
Agile Oracle database modeling and development - APEX Connect 2020
Agile Oracle database modeling and development - APEX Connect 2020Agile Oracle database modeling and development - APEX Connect 2020
Agile Oracle database modeling and development - APEX Connect 2020
 
Migration auf die OBIEE - OPITZ CONSULTING - Till Sander
Migration auf die OBIEE - OPITZ CONSULTING - Till SanderMigration auf die OBIEE - OPITZ CONSULTING - Till Sander
Migration auf die OBIEE - OPITZ CONSULTING - Till Sander
 
Sensitive Daten in der Oracle Datenbank
Sensitive Daten in der Oracle DatenbankSensitive Daten in der Oracle Datenbank
Sensitive Daten in der Oracle Datenbank
 
Das Repository-Pattern und der O/R-Mapper: Geniale Kombination oder vergebene...
Das Repository-Pattern und der O/R-Mapper: Geniale Kombination oder vergebene...Das Repository-Pattern und der O/R-Mapper: Geniale Kombination oder vergebene...
Das Repository-Pattern und der O/R-Mapper: Geniale Kombination oder vergebene...
 
Big Data Community Webinar vom 16. Mai 2019: Oracle NoSQL DB im Überblick
Big Data Community Webinar vom 16. Mai 2019: Oracle NoSQL DB im ÜberblickBig Data Community Webinar vom 16. Mai 2019: Oracle NoSQL DB im Überblick
Big Data Community Webinar vom 16. Mai 2019: Oracle NoSQL DB im Überblick
 
20190604_DOAGDatabase2019_OracleNoSQLDB_for_DBAs
20190604_DOAGDatabase2019_OracleNoSQLDB_for_DBAs20190604_DOAGDatabase2019_OracleNoSQLDB_for_DBAs
20190604_DOAGDatabase2019_OracleNoSQLDB_for_DBAs
 
Replikation im heterogenen Umfeld mit Oracle GoldenGate
Replikation im heterogenen Umfeld mit Oracle GoldenGateReplikation im heterogenen Umfeld mit Oracle GoldenGate
Replikation im heterogenen Umfeld mit Oracle GoldenGate
 
Automatisiertes disaster recovery testing mit der oracle cloud
Automatisiertes disaster recovery testing mit der oracle cloudAutomatisiertes disaster recovery testing mit der oracle cloud
Automatisiertes disaster recovery testing mit der oracle cloud
 
SQL Tuning Sets: Generieren, Verwenden, Transferieren, Szenarios
SQL Tuning Sets: Generieren, Verwenden, Transferieren, Szenarios SQL Tuning Sets: Generieren, Verwenden, Transferieren, Szenarios
SQL Tuning Sets: Generieren, Verwenden, Transferieren, Szenarios
 
Docker-Images mit vorinstallierter Instanz einer Oracle-DB
Docker-Images mit vorinstallierter Instanz einer Oracle-DBDocker-Images mit vorinstallierter Instanz einer Oracle-DB
Docker-Images mit vorinstallierter Instanz einer Oracle-DB
 
Spontan testen! Das eigene Test Lab, für jeden in der Cloud!
Spontan testen! Das eigene Test Lab, für jeden in der Cloud!Spontan testen! Das eigene Test Lab, für jeden in der Cloud!
Spontan testen! Das eigene Test Lab, für jeden in der Cloud!
 

Oracle Text 12c New Features

  • 1. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle Text 12c New Features Ulrike Schwinn Business Unit Database Oracle Deutschland B.V. & Co KG Deutschsprachiger Oracle Text Blog (@cczarski und @uschwinn) http://oracle-text-de.blogspot.de/
  • 2. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. New Features im Überblick • Performance – Erhöhung von MAX_INDEX_MEMORY – Near Real Time Index – BIG_IO – Separate Offsets – Query Result Cache – Pattern Stopclass
  • 3. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. New Features im Überblick • Document Service – Forward und Save Copy Index – Snippets für Result Set Interface • Abfragen – Neue und erweiterte Operatoren – SDATA Erweiterungen – Änderungen an Datastore Trigger • Internationalisierung – Document Lexer
  • 4. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. MAX_INDEX_MEMORY • Performance beim Anlegen, Verändern und Optimierung des Index – Memory Verwendung so hoch wie möglich setzen • Erhöhung von MAX_INDEX_MEMORY in 12c auf 256 GB (statt 2GB vorher) • Möglich mit CTX_ADM oder CREATE/ALTER INDEX Kommando • Sample Code: http://oracle-text-de.blogspot.de/2009/04/index-optimierung-einige-grundlagen.html execute ctx_adm.set_parameter('MAX_INDEX_MEMORY', '256G')
  • 5. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Near Real Time Index • Anforderung: Index möglich aktuell halten - sogar bei hoher Änderungsrate – Problem: Häufiges Synchronisieren führt zu Fragmentierung • Neu: Near real-time Index oder two level Index – Kleiner Stage Index im Memory und danach Merge in den Hauptindex • Nutze neue Option “STAGE_ITAB” für Storage Preference – Neue Tabelle $G und Index $H • Sample Code: stage_itab.sql, auto_opt.sql http://oracle-text-de.blogspot.de/2013/10/oracle-text-in-oracle-12c-automatic.html Aktualität Fragmentierung
  • 6. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Near Real Time Index - Beispiel • Preference anlegen • Optional: Cachen im KEEP Pool • Index anlegen exec ctx_ddl.create_preference('my_storage', 'BASIC_STORAGE') exec ctx_ddl.set_attribute('my_storage', 'STAGE_ITAB', 'true') exec ctx_ddl.set_attribute('my_storage','G_TABLE_CLAUSE', 'storage (buffer_pool keep)') exec ctx_ddl.set_attribute('my_storage','G_INDEX_CLAUSE', 'storage (buffer_pool keep)') create index my_index on my_table(text) indextype is ctxsys.context parameters('storage my_storage sync (on commit)')
  • 7. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Near Real Time Index - Beispiel insert into my_table values( 1, 'hello world' ); insert into my_table values( 2, 'goodbye world' ); commit; SQL> select token_text from dr$my_index$g; TOKEN_TEXT ---------------------------------------------------------------- GOODBYE HELLO WORLD SQL> select token_text from dr$my_index$i; no rows selected
  • 8. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Near Real Time Index - Merge • Manuell • Automatisch über Scheduler Job execute ctx_ddl.optimize_index(idx_name=>'MY_INDEX', optlevel=>'MERGE') exec ctx_ddl.add_auto_optimize( 'my_index' ) select job_name, program_name, last_start_date from dba_scheduler_jobs where owner='CTXSYS‘; JOB_NAME PROGRAM_NAME -------------------- -------------------- LAST_START_DATE ---------------------------------------------------------------------- DR$BGOPTJOB DR$BGOPTPRG 01-JUN-15 09.32.48.660822 AM EUROPE/VIENNA
  • 9. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Optimierung von TOKEN_INFO mit “BIG_IO” • In 11g: $I Tabelle mit TOKEN_INFO ist optimiert für BLOB mit 4000 Byte Chunks (Inline Storage) • In 12c: Nutzung von Securefiles mit großen Chunks => Reduzierung von Random I/O bei großen Indexeinträgen Name Null? Type ----------------- -------- ------------ TOKEN_TEXT NOT NULL VARCHAR2(64) TOKEN_TYPE NOT NULL NUMBER(3) TOKEN_FIRST NOT NULL NUMBER(10) TOKEN_LAST NOT NULL NUMBER(10) TOKEN_COUNT NOT NULL NUMBER(10) TOKEN_INFO BLOB
  • 10. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Optimierung von TOKEN_INFO mit “BIG_IO” • Realisierung über neue Storage Preference BIG_IO • Sample Code: big_io.sql, big_io_test.sql http://oracle-text-de.blogspot.in/2015/06/12c-feature-i-tabelle-mit-neuer-storage.html exec ctx_ddl.create_preference('my_storage', 'BASIC_STORAGE' ) exec ctx_ddl.set_attribute('my_storage', 'BIG_IO', 'true' )
  • 11. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Optimierung von TOKEN_INFO mit „separate Offsets“ • TOKEN_INFO besteht aus DOCID und OFFSET Informationen Oracle Confidential – 1 1001 Nacht und Tag, Tag und Nacht 1002 Es war eine stürmische Nacht NACHT (DOCID 1, INFO 1,2)(DOCID 2, INFO 3) TAG (DOCID 1, INFO 4,5) STÜRMISCHE (DOCID 2, INFO 6) TOKEN_TEXT TOKEN_INFO (BLOB) ID TEXT
  • 12. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Optimierung von TOKEN_INFO mit “Separate Offsets” • Problematik: Offset Daten können groß werden • Wann überhaupt Offset Informationen? – Notwendig für Phrasen, NEAR und Zone Section Abfragen – NICHT notwendig für Single Term Abfragen, Boolean oder Score Suche, bei AND, OR, NOT, MINUS und FIELD Suche Neu in 12c: DOCID und Token Offsets können in separaten Spalten abgelegt werden • Sample Code: separate_offsets.sql
  • 13. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Optimierung von TOKEN_INFO mit “Separate Offsets” • Neue Option SEPARATE_OFFSETS exec ctx_ddl.create_preference( 'my_storage', 'BASIC_STORAGE' ) exec ctx_ddl.set_attribute ( 'my_storage', 'SEPARATE_OFFSETS', 'true' ) describe dr$my_index$i Name Null? Type ----------------------------------------- -------- ---------------------- TOKEN_TEXT NOT NULL VARCHAR2(64) TOKEN_TYPE NOT NULL NUMBER(10) TOKEN_FIRST NOT NULL NUMBER(10) TOKEN_LAST NOT NULL NUMBER(10) TOKEN_COUNT NOT NULL NUMBER(10) TOKEN_INFO BLOB TOKEN_OFFSETS BLOB
  • 14. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Performance mit Forward und Save Copy Index • Problem: Snippets und Highlight Operationen sind langsam, da das ganze Dokument noch einmal ”processed” werden muss • Lösung: – Kopie als Forward Index in neue Tabelle $O – “Save Copy” Ablage in neue Tabelle $D (zusätzlich Compressed, Tokinized mit Stopwörtern, als Plaintext oder gefiltert) • Sample Code: forward_index.sql, snippets.sql http://oracle-text-de.blogspot.de/2015/02/schnellere-text-abfragen-mit-snippet-in.html exec ctx_ddl.create_preference( 'my_store', 'BASIC_STORAGE' ) exec ctx_ddl.set_attribute ( 'my_store', 'FORWARD_INDEX', 'TRUE' ) exec ctx_ddl.set_attribute ( 'my_store', 'SAVE_COPY', 'PLAINTEXT' )
  • 15. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Spezieller Ergebniscache für Text-Abfragen • Ähnlich wie bei Query Result Cache: spezieller Bereich für sich wiederholende Resultate • Gut geeignet für nachträgliches Filtern von Ergebnissen • Neue Storage Option QUERY_FILTER_CACHE_SIZE • Neue Operator CTXFILTERCACHE mit zusätzlichen Optionen wie “save score” oder nur “top N by score” execute ctx_ddl.create_preference('my_i_storage', 'basic_storage'); execute ctx_ddl.set_attribute('my_i_storage','query_filter_cache_size', '10M'); ctxfiltercache((query_text) [, save_score] [, topN])
  • 16. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Spezieller Ergebniscache für Text-Abfragen - Beispiele select * from texttabelle where contains(dokument, 'ctxfiltercache((Obama), true, true) and sdata(ressort = ''Politik'')' ) > 0; exec ctx_query.store_sqe( 'securityclause1', '( john within secusers or sales within secgroups )', ctx_query.DURATION_SESSION); select * from my_table where contains(text, 'fox and SQE(securityclause1)') > 0; select * from my_table where contains( text, 'fox and ctxfiltercache( (SQE(securityclause1)) )') > 0; • Auch mit neuem Feature Session Duration Stored Query Expressions (SQE) • Sample code: query_filter_cache.sql http://oracle-text-de.blogspot.de/2014/09/ergebniscache-fur-text-abfragen.html
  • 17. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Operatoren: NEAR und MNOT • NEAR Erweiterungen – Nested NEAR; NEAR zusätzlich mit Ausdrücken • MNOT (mild not) Operator – Wörter, welche nicht Teil sind von … • Sample Code: mnot.sql SELECT * FROM docs WHERE CONTAINS(txt, 'near((near((term1, term2),5), term3), 100)')>0 select * from my_table where contains(text, 'york MNOT new york' ) > 0; York is in Yorkshire, New York is in New York York is a city in England
  • 18. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Pattern Stopclass • Definition von Stopwörtern mit “regular expression” • Beispiele – Keine Zahlen >= 5 Ziffern – Keine langen Wörter >= 20 Zeichen • Hinweis: Definition einer eigenen Stopliste ist erforderlich (nicht anwendbar auf Default Listen) • Sample Code: pattern_stopclass.sql http://oracle-text-de.blogspot.de/2013/07/oracle-text-in-oracle12c-neues-feature.html ctx_ddl.add_stopclass('stop', 'longwords', '[[:alnum:]]{20,}' ) exec ctx_ddl.add_stopclass('stop', 'fivedignums', '[[:digit:],.]{5,}')
  • 19. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Languages und Lexer • Neue CTX_DOC Prozedur policy_languages – Liefert Liste der Sprachen für ein Dokument (vergleichbar mit AUTO_LEXER) • Document Level Lexer – Verschiedene Lexer für unterschiedliche Dokumente => Sprachen unabhängiger Sublexer – Basiert auf MULTI_LEXER Technologie
  • 20. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. SDATA Erweiterungen • Updatable SDATA Sections – Synchrone Updates auf SDATA ohne Re-Indizierung • Hinzufügen von SDATA Sektionen zum existierenden Index – Kein Re-Create erforderlich • Mehr SDATA Sektionen (Maximal 99) – Maximum FILTER BY / ORDER BY noch bei 32 • Sample Code: sdata.sql
  • 21. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. SDATA Erweiterungen • Query Template kann nun nach SDATA sortieren <query> <textquery> digital and sdata(stocklevel > 4) </textquery> <order> <orderkey> SDATA(stocklevel) desc </orderkey> <orderkey> score desc </orderkey> </order> </query>
  • 22. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Änderungen an Datastore Trigger • Index auf verschiedenen Spalten mit MULTI_COLUMN_STORE und USER_DATASTORE – Normalerweise Verwendung von Triggern wie folgt • In 12c wird nun der Status von allen Spalten überprüft! Trigger wirkt nur wenn alle Spalten verändert wurden. • Fix mit Session oder System Kommando CREATE OR REPLACE TRIGGER customer_update_trg BEFORE UPDATE OF lastname ON customers FOR EACH ROW BEGIN :new.firstname := :new.firstname; END; alter session set "_fix_control"='14155722:OFF'
  • 23. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Snippet Support in Result Set Interface • Result Set Interface – XML Query Support seit 11g – Result Set Descriptor (XML Block) beschreibt Resultate in einem (!) SQL Call – Bereits für ROWIDs und SDATA Werte • Ab 12c auch für Snippets <ctx_result_set_descriptor> <hitlist start_hit_num="1" end_hit_num="10" order="SCORE DESC"> <rowid /> <score /> <sdata name="title" /> <snippet radius="20" max_length="160" starttag="&lt;b&gt;" endtag="&lt;/b&gt;" /> </hitlist> <count /> </ctx_result_set_descriptor>
  • 24. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. XQuery Text Unterstützung • Volltextsuche im XML DB Framework • “Universal Index” erlaubt das Mischen von strukturierten und unstrukturierten Daten • Nutze PATH SECTION Typ mit XML_ENABLE = 'true' SELECT po.id FROM PURCHASEORDER po WHERE XMLExists ('$src/purchaseOrder/billingInstruction/Address [. contains text {$PHRASE1} ftand {$PHRASE2} using stemming] ' PASSING po.x, 'Science' as “PHRASE1”, 'Magdalen' as“PHRASE2”)
  • 25. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. New Features im Überblick • Performance – Erhöhung von MAX_INDEX_MEMORY für mehr OPTIMIZE und CREATE Performance – Near Real Time Index: Häufige Index Syncs ohne Fragmentierung – BIG_IO: Neue Indexarchitektur reduziert Index Lookups bei großen Indexfragmenten – Separate Offsets: Trennung der Offset Informationen in der Indexstruktur reduziert I/O für Abfragen, in denen Wortpositionen nicht gebraucht wird – Query Result Cache: Spezieller Ergebniscache – Pattern Stopclass: reguläre Ausdrücke für Tokens, die nicht indiziert werden sollen
  • 26. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. New Features im Überblick • Document Service – „Forward and Save Copy“ Index: mehr Performance für Snippet Operationen – Snippets für Result Set Interface • Abfragen – Neue und erweiterte Operatoren – SDATA Erweiterungen • Internationalisierung – Document Lexer
  • 27. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. Informationen • White Paper – http://www.oracle.com/technetwork/database/information- management/oracletext12cfeatures-1932547.pdf • Sample Code auf OTN – http://www.oracle.com/us/products/database/enterprise- edition/12ctechnicaloverview-1961500.zip?ssSourceSiteId=otnen • OTN mit Oracle Text – http://www.oracle.com/technetwork/database/features/index-098492.html