xml datu glabāšanas varianti oracle xml db datu bāzē web view10/3/2010 · xml...

16
XML tehnoloģiju attīstība 1

Upload: vantu

Post on 30-Jan-2018

246 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: XML datu glabāšanas varianti Oracle XML DB datu bāzē Web view10/3/2010 · XML tehnoloģiju attīstība. XMLType datu tips. 1. XMLType ir . abstrakts datu tips. XML datu glabāšanai

XML tehnoloģiju attīstība

1

Page 2: XML datu glabāšanas varianti Oracle XML DB datu bāzē Web view10/3/2010 · XML tehnoloģiju attīstība. XMLType datu tips. 1. XMLType ir . abstrakts datu tips. XML datu glabāšanai

XMLType datu tips

1. XMLType ir abstrakts datu tips XML datu glabāšanai un apstrādei datu bāzē.

2. XMLType iekļauj metodes XML datu izveidošanai, izgūšanai un indeksēšanai.

3. XMLType ļauj datu izgūšanu veikt ar SQL valodas palīdzību.

4. XMLType tipa mainīgie var tikt lietoti PL/SQL glabājamās procedūrās (stored procedures) kā parametri un atgriešanas (return) vērtības.

5. XMLType tipu var izmantot SQL, PL/SQL, C, Java (lietojot JDBC) un Oracle Data Provider for .NET (ODP.NET).

2

Page 3: XML datu glabāšanas varianti Oracle XML DB datu bāzē Web view10/3/2010 · XML tehnoloģiju attīstība. XMLType datu tips. 1. XMLType ir . abstrakts datu tips. XML datu glabāšanai

XML datu glabāšanas varianti

3

Page 4: XML datu glabāšanas varianti Oracle XML DB datu bāzē Web view10/3/2010 · XML tehnoloģiju attīstība. XMLType datu tips. 1. XMLType ir . abstrakts datu tips. XML datu glabāšanai

XML datu glabāšana izmantojot XMLType datu tipu

1. XML datu glabāšana tabulas rindās ar XMLType tipa objektiem.

2. XML datu glabāšana XMLType tipa tabulas kolonās.

3. Datus XML tipa tabulas rindā vai kolonā var glabāt trīs veidos:

1) nestrukturētā veidā – XMLType dati tiek glabāti Character

Large Object (CLOB) tipa struktūrās;

2) strukturētā veidā – XMLType dati tiek glabāti kā objektu kopa

relāciju-objektu datu bāzē. Šo glabāšanas veidu tāpēc sauc arī

par XML datu objektu – relāciju glabāšanu.

3) binārā veidā – XMLType dati tiek glabāti izanalizētā un

sakārtotā veidā (post – parsed), binārā formātā, kas ir izveidots

tieši XML datu glabāšanai (sākot ar Oracle11g). Tas ir

efektīvākais glabāšanas veids.

4

Page 5: XML datu glabāšanas varianti Oracle XML DB datu bāzē Web view10/3/2010 · XML tehnoloģiju attīstība. XMLType datu tips. 1. XMLType ir . abstrakts datu tips. XML datu glabāšanai

XML datu glabāšanas veidi datu bāzē

Structured (object-relational) storage advantages over the other storage models include near-relational query and update performance, optimized memory management, reduced storage requirements, B-tree indexing, and in-place updates. These advantages are at a cost of increased processing overhead during ingestion and full retrieval of XML data, and reduced flexibility in the structure of the XML that can be managed by a given XMLType table or column. Structural flexibility is reduced because data and metadata (such as column names) are separated in object-relational storage. Instance structures cannot vary easily. Structured storage is particularly appropriate for highly structured data whose structure does not vary, if this maps to a manageable number of database tables and joins.

Unstructured (CLOB) storage enables higher throughput than structured storage when inserting and retrieving entire XML documents. No data conversion is needed, so the same format can be used outside the database. Unstructured storage also provides greater flexibility than structured storage in the structure of the XML that can be stored. Unstructured storage is particularly appropriate for document-centric use cases. These advantages can come at the expense of certain aspects of intelligent processing: in the absence of indexing, there is little that the database can do to optimize queries or updates on XML data that is stored in a CLOB instance. In particular, the cost of XML parsing (often implicit) can significantly impact query performance. Indexing with XMLIndex can improve the performance of queries against unstructured storage.

Binary XML storage provides more efficient database storage, updating, indexing, and fragment extraction than unstructured storage. It can provide better query performance than unstructured storage — it does not suffer from the XML parsing bottleneck (it is a post-parse persistence model). Like structured storage, binary XML storage is aware of XML Schema data types and can take advantage of native database data types. Like structured storage, binary XML storage allows for piecewise updates. Because binary XML data can also be used outside the database, it can serve as an efficient XML exchange medium, and you can off load work from the database to increase overall performance in many cases. Like unstructured storage, binary XML data is kept in document order. Like structured storage, data and metadata can, using binary storage, be separated at the database level, for efficiency. Like unstructured storage, however, binary XML storage allows for intermixed data and metadata, which lets instance structures vary. Binary XML storage allows for very complex and variable data, which in the structured-storage model could necessitate using many database tables. Unlike the other XMLType storage models, you can use binary storage for XML schema-based data even if the XML schema is not known beforehand, and you can store multiple XML schemas in the same table and query across common elements.

5

Page 6: XML datu glabāšanas varianti Oracle XML DB datu bāzē Web view10/3/2010 · XML tehnoloģiju attīstība. XMLType datu tips. 1. XMLType ir . abstrakts datu tips. XML datu glabāšanai

XML dokumenta glabāšana XMLType datu tipa tabulas kolonnā

6

Page 7: XML datu glabāšanas varianti Oracle XML DB datu bāzē Web view10/3/2010 · XML tehnoloģiju attīstība. XMLType datu tips. 1. XMLType ir . abstrakts datu tips. XML datu glabāšanai

XMLType datu glabāšanas veidi

Nestrukturētā un binārā glabāšanas veida norādīšanai jālieto STORE AS izteiksme CREATE TABLE komandā.

7

Page 8: XML datu glabāšanas varianti Oracle XML DB datu bāzē Web view10/3/2010 · XML tehnoloģiju attīstība. XMLType datu tips. 1. XMLType ir . abstrakts datu tips. XML datu glabāšanai

Uz datiem un uz dokumentiem orientētie XML avoti

8

Page 9: XML datu glabāšanas varianti Oracle XML DB datu bāzē Web view10/3/2010 · XML tehnoloģiju attīstība. XMLType datu tips. 1. XMLType ir . abstrakts datu tips. XML datu glabāšanai

XML dokumentu shēmas izmantošana datu bāzē

XMLType tipu glabāšanas variantu priekšrocības

Quality Structured (Object-Relational) Storage Binary XML Storage Unstructured (CLOB)

Storage

Throughput

– XML decomposition can result in reduced throughput when ingesting or retrieving the entire content of an XML document.

+ High throughput. Fast DOM loading. There is a slight overhead from the binary XML encoder/decoder.

++ High throughput when ingesting and retrieving the entire content of an XML document.

Queries ++ Extremely fast: relational query performance.

You can create B-tree indexes on the underlying object-relational columns.

+ Streaming XPath evaluation avoids DOM construction and allows evaluation of multiple XPath expressions in a single pass. Navigational XPath evaluation is significantly faster than with unstructured storage.

XMLIndex indexing can

– XPath operations are evaluated by constructing a DOM from the CLOB data and using functional evaluation. Expensive when performing operations on large documents or large collections of documents.

XMLIndex indexing can

9

Page 10: XML datu glabāšanas varianti Oracle XML DB datu bāzē Web view10/3/2010 · XML tehnoloģiju attīstība. XMLType datu tips. 1. XMLType ir . abstrakts datu tips. XML datu glabāšanai

Quality Structured (Object-Relational) Storage Binary XML Storage Unstructured (CLOB)

Storage

improve performance of XPath-based queries.

improve performance of XPath-based queries.

Update operations

(DML)

++ Extremely fast: relational columns are updated in place.

+ In-place, piecewise update for SecureFile LOB storage.

– When any part of the document is updated, the entire document must be written back to disk.

Space efficiency

(disk)

++ Extremely space-efficient. + Space-efficient.

– Consumes the most disk space, due to insignificant whitespace and repeated tags.

Data flexibility

– Limited flexibility. Only documents that conform to the XML schema can be stored in the XMLType table or column.

+ Flexibility in the structure of the XML documents that can be stored in an XMLType column or table.

+ Flexibility in the structure of the XML documents that can be stored in an XMLType column or table.

XML schema flexibility

– An XMLType table can only store documents that conform to the same XML schema.

In-place XML schema evolution is available, with some restrictions.

++ Can store XML schema-based or non-schema-based documents. An XMLType table can store documents that conform to any registered XML schemas.

++ Can store XML schema-based or non-schema-based documents. Cannot use multiple XML schemas for the same XMLType table.

XML fidelity

DOM fidelity: A DOM created from an XML document that has been stored in the database is identical to a DOM created from the original document. However, insignificant whitespace may be discarded.

DOM fidelity (see structured storage description).

+ Document fidelity: Maintains the original XML data, byte for byte. In particular, all original whitespace is preserved.

Indexing support

+ B-tree, bitmap, Oracle Text, XMLIndex, and function-based indexes.

XMLIndex, function-based, and Oracle Text indexes.

XMLIndex, function-based, and Oracle Text indexes.

Optimized memory

management

+ XML operations can be optimized to reduce memory requirements.

+ XML operations can be optimized to reduce memory requirements.

– XML operations on the document require creating a DOM from the document.

Validation upon insert

XML data is partially validated when it is inserted.

+ XML schema-based data is fully validated when it is inserted.

XML schema-based data is partially validated when it is inserted.

Partitioning + Available. Partition based on virtual columns.

XMLType columns can be partitioned if the partitioning key is a relational column.

Streams-based – Not available. – Not available. ++ Available.

10

Page 11: XML datu glabāšanas varianti Oracle XML DB datu bāzē Web view10/3/2010 · XML tehnoloģiju attīstība. XMLType datu tips. 1. XMLType ir . abstrakts datu tips. XML datu glabāšanai

Quality Structured (Object-Relational) Storage Binary XML Storage Unstructured (CLOB)

Storagereplication

Compression++ XML elements and attributes can be compressed individually.

+ XML data that uses SecureFile LOB storage can be compressed.

– Not available.

11

Page 12: XML datu glabāšanas varianti Oracle XML DB datu bāzē Web view10/3/2010 · XML tehnoloģiju attīstība. XMLType datu tips. 1. XMLType ir . abstrakts datu tips. XML datu glabāšanai

XMLType datu tipa izmantošanas kopējā shēma

12