* [[topbar |Table of Contents]] * [[intro:overview:what|Introduction]] * [[install:home|Installation]] * [[install:editions|Product Editions]] * [[install:requirements|System Requirements]] * [[install:platforms|Supported Platforms]] * [[install:guides:home|Installation Guides]] * [[install:licensing:home|Licensing]] * [[install:releases:home|Release Notes]] * [[admin:home|Administration]] * [[admin:admin:home|Administration Basics]] * [[admin:admin:architecture:home|Omnidex Architecture]] * [[admin:admin:applications:home|Building Applications]] * [[admin:basics:home|Omnidex Fundamentals]] * [[admin:basics:environments:home|Omnidex Environments]] * [[admin:basics:sqlengine:home|Omnidex SQL Engine]] * [[admin:basics:updates:home|Omnidex Updates]] * [[admin:basics:network:home|Network Services]] * [[admin:indexing:home|Omnidex Indexing]] * [[admin:indexing:concepts:home|Indexing Concepts]] * [[admin:indexing:indexes:home|Indexing Options]] * [[admin:indexing:creation:home|Index Creation]] * [[admin:indexing:strategies:home|Indexing Strategies]] * [[admin:indexing:activecounts:home|ActiveCounts]] * [[admin:indexing:powersearch:home|PowerSearch]] * [[admin:indexing:autocomplete:home|AutoComplete]] * [[admin:indexing:text:home|Omnidex Text]] * [[admin:features:home|Omnidex Features]] * [[admin:features:snapshots:home|Omnidex Snapshots]] * [[admin:features:grids:home|Omnidex Grids]] * [[admin:features:rollups:home|Rollup Tables]] * [[admin:features:geo:home|Geographic Searches]] * [[admin:features:expressioncols:home|Expression Columns]] * [[admin:features:segments:home|Omnidex Segments]] * [[admin:features:attach:home|Attaching Data]] * [[admin:features:export:home|Exporting Data]] * [[admin:optimization:home|Optimizing Queries]] * [[admin:optimization:plans:home|Query Plans]] * [[admin:optimization:caches:home|Dynamic Caches]] * [[admin:optimization:config:home|Configuring Omnidex]] * [[integration:home|Integration]] * [[integration:rdbms:home|Relational Databases]] * [[integration:rdbms:oracle:home|Oracle]] * [[integration:rdbms:sqlserver:home|SQL Server]] * [[integration:rdbms:mysql:home|MySQL]] * [[integration:rdbms:odbc:home|Generic ODBC]] * [[integration:rawdata:home|Raw Data Files]] * [[integration:rawdata:fixed:home|Fixed-length Files]] * [[integration:rawdata:delimited:home|Delimited Files]] * [[integration:rawdata:ost:home|Standalone Tables]] * [[dev:home|Development]] * [[dev:sql:home|Omnidex SQL]] * [[dev:sql:overview|Overview]] * [[dev:sql:statements:home|Statements]] * [[dev:sql:functions:home|Functions]] * [[dev:sql:examples:home|Examples]] * [[dev:connections:home|Connection Strings]] * [[dev:odbc:home|ODBC Interface]] * [[dev:jdbc:home|JDBC Interface]] * [[dev:debugging:home|Logging/Debugging]] * [[programs:home|Programs]] * [[programs:odxsql:home|OdxSQL]] * [[programs:odxnet:home|OdxNet]] * [[appendix:home|Appendix]] * [[dev:sql:home|Omnidex SQL]] * [[dev:sql:statements:home|Statements]] * [[dev:sql:functions:home|Functions]] * [[dev:sql:examples:home|Examples]] * [[http://www.omnidex.com/download/|Downloads]] * [[support:home|Support]]

~~NOTOC~~ {{page>:top_add&nofooter&noeditbtn}} ====== Administration: Omnidex Indexing ====== ===== Indexing Concepts ===== [[admin:indexing:concepts:home|Overview]] | [[admin:indexing:concepts:criteria|Criteria]] | **[[admin:indexing:concepts:joins|Joins]]** | [[admin:indexing:concepts:aggregations|Aggregations]] | [[admin:indexing:concepts:ordering|Ordering]] | [[admin:indexing:concepts:retrieval|Retrievals]] ---- ==== Table Joins ==== Omnidex indexing is also valuable for processing table joins. Omnidex first considers the purpose of the table join. Some table joins are required to allow criteria to be processed. These are called Qualification Joins. Other table joins are required to obtain data to return to the user. These are called Retrieval Joins. === Qualification Joins === It is common to join to a table so that criteria can be processed against it. The following example shows a join that returns columns from the INDIVIDUALS table to the user, but also joins to the HOUSEHOLDS and STATES tables to process criteria. These joins are Qualification Joins since no data is returned to the user from these tables. <code> select I.NAME, I.PHONE from INDIVIDUALS I join HOUSEHOLDS H on I.HOUSEHOLD = H.HOUSEHOLD join STATES S on H.STATE = S.STATE where S.TAX_RATE > 5.0; </code> Omnidex will always attempt to process Qualification Joins in the indexes without ever going to the disk drive, as this dramatically improves performance. If the join columns are indexed with Omnidex, then Omnidex will process the criteria in the STATES table, use indexes to join to the HOUSEHOLDS table, and then use indexes to join to the INDIVIDUALS table. Omnidex can optimize this type of join most efficiently when joining FROM a parent table INTO a child table. In this example, the STATES table is a parent of HOUSEHOLDS, and HOUSEHOLDS is a parent of INDIVIDUALS. It is easy for Omnidex to perform this kind of join in the indexes since the primary keys are available from the indexes. Omnidex isolates the primary keys from the parent table and uses them as criteria in a search against the child table. Omnidex also optimizes queries that join INTO a parent table FROM a child table, but it may require accessing the database. Omnidex also provides an advanced featured called pre-joined indexes. Pre-joined indexes are especially useful for processing criteria in multiple children of the same parent. Pre-joined indexes store foreign key information in the indexes allowing faster access between a parent and multiple children. The [[admin:indexing:advanced:joins|following article]] explains pre-joined indexes in more detail. === Retrieval Joins === Some tables are joined so that data can be returned to the user. The following example shows a join that returns columns from the INDIVIDUALS, HOUSEHOLDS and STATES tables. These joins are Retrieval Joins since data is returned from these tables to the user. <code> select I.NAME, H.ADDRESS, H.CITY, H.STATE, I.PHONE, S.TAX_RATE from INDIVIDUALS I join HOUSEHOLDS H on I.HOUSEHOLD = H.HOUSEHOLD join STATES S on H.STATE = S.STATE where I.NAME = 'John Smith' </code> These joins are easily optimized by simply indexing the join columns. === When to Avoid Indexes === When tables share a fairly specific key, such as a HOUSEHOLD ID, an index makes it easy to retrieve common rows between the two tables. This is only efficient when retrieving a small portion of each table. If two tables are to be joined in their entirety, indexing will actually slow things down for the same reasons discussed in the [[admin:indexing:concepts:criteria|Criteria]] section. In the example above, the criteria against the NAME column probably isolates a small number of rows, and so using indexes for this join makes sense. If the query retrieved a large portion of each table, indexing would be less helpful. This query below retrieves all rows in the United States, which probably comprises a large percentage of this database. <code> select I.NAME, H.ADDRESS, H.CITY, H.STATE, I.PHONE, S.TAX_RATE from INDIVIDUALS I join HOUSEHOLDS H on I.HOUSEHOLD = H.HOUSEHOLD join STATES S on H.STATE = S.STATE where H.COUNTRY = 'US'; </code> In this case, it may be faster to use other techniques than an indexed join. Omnidex provides a feature called a Sort-Merge Join. This technique sorts two tables or result sets and then scans them, matching entries as it goes. This can provide a significant improvement in performance. Omnidex provides another feature called the Hashed Data Cache. This can be even faster still, and is ideal when joining to a fairly small table, such as a small dimension table. If the required portion of a table can be read into memory with a hashed index, then joins to that table will be instantaneous. The disk drives are hit once to load the required portion of a table into memory, but thereafter, the disk drives are not impacted. This optimization is commonly used when joining to dimension tables or code lookup tables. In the example above, the STATES would be small enough to use this technique since it probably has less than 100 entries. Omnidex automatically chooses between these approaches to table joins, and no intervention is required by the user. ==== ==== The [[admin:indexing:strategies:joins|following article]] explains basic indexing strategies for optimizing table joins. ===== ===== **[[admin:indexing:concepts:criteria|Prev]]** **[[admin:indexing:concepts:aggregations|Next]]** ====== Additional Resources ====== See also: {{page>:admin:indexing:see_also&nofooter&noeditbtn}} {{page>:bottom_add&nofooter&noeditbtn}}

 
Back to top
admin/indexing/concepts/joins.txt ยท Last modified: 2016/06/28 22:38 (external edit)
 
 
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0