Presentation is loading. Please wait.

Presentation is loading. Please wait.

Optimizing SQL Pertemuan 13 Matakuliah: T0413/Current Popular IT II Tahun: 2007.

Similar presentations


Presentation on theme: "Optimizing SQL Pertemuan 13 Matakuliah: T0413/Current Popular IT II Tahun: 2007."— Presentation transcript:

1 Optimizing SQL Pertemuan 13 Matakuliah: T0413/Current Popular IT II Tahun: 2007

2 Bina Nusantara Learning Outcomes Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu mendemonstrasikan proses optimasi di dalam SQL

3 Bina Nusantara Outline Materi Using indexes Types of indexes Reprashing queries

4 Bina Nusantara USING INDEX One of important ways to improve system Performance

5 Bina Nusantara SEVERAL WAYS TO CATEGORIZE INDEXES UNIQUE NON UNIQUE

6 Bina Nusantara CREATE INDEX SINTAX : CREATE [UNIQUE] INDEX index-Name ON table-Name ( Simple- column-Name [ ASC | DESC ] [, Simple-column-Name [ ASC | DESC ]] * )index-Nametable-NameSimple- column-NameSimple-column-Name

7 Bina Nusantara TYPE OF INDEXS B+ trees Join indexes & clusters Bitmap indexes R-trees

8 Bina Nusantara REPHRASING QUERIES Optimizer in the DBMS is supposed to convert queries to the most efficient formulation and execution Two general flavors of optimizer – Rule based – Cost based

9 Bina Nusantara REPHRASING QUERIES Here are some rules of thumb to make queries run faster : 1. Be careful about using value expressions or datatype conversions on indexed values used in predicates 2. The same applies to <> (does not equal)

10 Bina Nusantara REPHRASING QUERIES (Cont.) 3. ANY and EXISTS 4. Place the predicates that are likely to eliminate the most rows from the output first in where clause

11 Bina Nusantara REPHRASING QUERIES (Cont.) 5. LEFT and RIGHT OUTER joins are interconvertible. LEFT joins may be faster 6. In a join, place the table with fewer rows first in the FROM clause. 7. With an indexes column referenced in a predicate, you may do a bit better by combining equalities and inequalities (x>=8 lebih cepat daripada x>7) 8. NULLs value

12 Bina Nusantara REPHRASING QUERIES (Cont.) 9. If we want more than 20 percent rows of table better off without using an index 10. If we refferencing a multi column index, you need not reference the query every column 11. Avoid using like 12. Often a UNION of two queries will do better than a single query (using OR)


Download ppt "Optimizing SQL Pertemuan 13 Matakuliah: T0413/Current Popular IT II Tahun: 2007."

Similar presentations


Ads by Google