Home > Ask the Oracle Database / Applications Experts > Oracle database internals Questions & Answers > Rules for creating efficient queries
Ask The Oracle Expert: Questions & Answers
EMAIL THIS

Rules for creating efficient queries

Don Burleson EXPERT RESPONSE FROM: Don Burleson

Pose a Question
Other Oracle Categories
Meet all Oracle Experts
Become an Expert for this site


Oracle tips, scripts, and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 01 November 2005
Hi, can you tell me the main rules to create an efficient query? I know there are a lot of articles about this, but I can't find these rules. I'm a DBA and I have to tune some queries.

>
There are several rules for creating "efficient" queries, but not all of them apply to all situations.

  • Cache frequently referenced tables and indexes in the KEEP pool.
  • Use temporary tables (GTT) to improve SQL performance of complex queries.
  • Implement query re-write within an Oracle database (materialized views)
  • Use dbms_stats for good execution plans.
  • Check to make sure that your query uses the most selective possible index (especially function-based indexes). Check the "where" clause of the query and compare indexes in dba_indexes.
  • Avoid subqueries whenever possible, but if you must have them, use IN if most of the filtering conditions are in the subquery; use EXISTS otherwise.

Here is a good list of tips for writing efficient SQL.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Oracle database internals
How to find a dropped table?
Removing carriage returns at the end of clob fields
Finding length of numeric datatype field
Problem with incoming parameter in dynamic SQL statement
Reading WSID from back-end
Making a select statement faster
Select * from loc
Difference between 9i and 10g OCP exams
Concatenate values separated with commas
How to free up more space for Oracle?

Oracle and SQL
Can I specify Oracle column order in my database table?
Review: Oracle's 11g R2 database has some good and bad
SELECT statement syntax and examples
Oracle PL/SQL tutorial
PL/SQL datatypes in Oracle
PL/SQL functions and triggers in Oracle
Stored procedures in PL/SQL
Do I need a license for SQL Developer Data Modeler in Oracle?
Using the SQL GROUP BY clause for counting combinations
How to use an SQL CASE expression
Oracle and SQL Research

Oracle database performance problems and tuning
Oracle releases new database, says 11g upgrade will cut costs
Oracle raises prices on database management packs
Oracle New Year's resolutions, part 1: Advice for navigating 2009
Solving common Oracle errors guide
Oracle 11g data compression
Varchar or number for better performance?
Do statistics on SYS-owned objects hurt performance in 10g?
Inside the Oracle 11g SQL Performance Advisor, part 1
Inside the Oracle 11g SQL Performance Advisor, part 2
Difference between driving table and driver table in Oracle

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
autonomous transaction  (SearchOracle.com)
CFML  (SearchOracle.com)
dynamic SQL  (SearchOracle.com)
foreign key  (SearchOracle.com)
Java Database Connectivity  (SearchOracle.com)
Open Database Connectivity  (SearchOracle.com)
Oracle  (SearchOracle.com)
stored procedure  (SearchOracle.com)
The Open Group  (SearchOracle.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Oracle White Papers: Fusion Middleware
HomeNewsTopicsTipsAsk the ExpertsMultimediaWhite PapersProductsBlogs
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2003 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts