This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
sql:explain:home [2010/05/12 21:21] tdo created |
sql:explain:home [2012/10/26 14:51] (current) |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| <html><div align="center"><span style="color:red">DRAFT</span></div></html> | <html><div align="center"><span style="color:red">DRAFT</span></div></html> | ||
| ===== Optimizing Query Performance ===== | ===== Optimizing Query Performance ===== | ||
| - | |||
| ==== OdxSQL Explain Plans ==== | ==== OdxSQL Explain Plans ==== | ||
| Line 12: | Line 11: | ||
| odxsql> explain | odxsql> explain | ||
| - | For more detailed counts | + | <code> |
| + | > explain | ||
| + | ----------------------------------- SUMMARY ----------------------------------- | ||
| + | Select * | ||
| + | from TABLE1 | ||
| + | where MYTEXT = 'bears'; | ||
| + | |||
| + | Version: 5.1 Build 1A (Compiled May 6 2010 21:06:44) | ||
| + | Optimization: MDKQUAL | ||
| + | ----------------------------------- DETAILS ----------------------------------- | ||
| + | Qualify (TABLE1)TABLE1 where MYTEXT = 'bears' on 1 with NOAUTORESET (Cached); | ||
| + | Fetchkeys $ROWID 1000 at a time on 1; | ||
| + | Retrieve TABLE1 using $ROWID = $ODXID; | ||
| + | Return TABLE1.MYSEQ, TABLE1.MYTEXT; | ||
| + | ------------------------------------------------------------------------------- | ||
| + | </code> | ||
| + | |||
| + | For more detailed information and cpu timing statistics, issue the SET EXPLAIN COUNTS setting. | ||
| odxsql> set explain counts | odxsql> set explain counts | ||
| - | to get counts | + | Check the warnings |
| + | check the retrieve | ||
| + | |||
| + | Any time see Retrieve, Omnidex had to read the data files. | ||
| + | ==== Optimization ==== | ||
| + | |||
| + | Nested queries can many times be optimized by Omnidex automatically. | ||
| + | Some SQL statements that look complex like nested queries can be optimized by Omnidex. | ||
| + | |||
| + | Omnidex can look inside nested queries in the WHERE clause and can re-write the SQL and optimize. | ||
| + | |||
| + | Nested Queries in the FROM clause rarely allow Omnidex to do optimization. | ||
| + | |||
| + | Try to re-work sub-queries in the FROM clause and put them in the WHERE clause. | ||
| + | |||
| + | === Nested Queries === | ||
| + | |||
| + | select count(*) from INDIVIDUAL | ||
| + | |||
| + | What enables navigation from child to parent is just putting prejoin on a constraint. | ||
| + | |||
| + | Typically don't have to create custom indexes for this type of prejoin index operation. | ||
| + | |||
| + | custom indexes with prejoins can have further options such as record_complex and record_specific. | ||
| {{page>:bottom_add&nofooter&noeditbtn}} | {{page>:bottom_add&nofooter&noeditbtn}} | ||