logo for asktheoracle.net
Home
AskTheOracle Blog
Oracle Tips & Tricks
Oracle Training
Oracle Tutorials
PL/SQL
SQL
Advanced Tutorials
Performance Tuning
Certification
Oracle 10g
Oracle 11g
Oracle and .Net
Oracle Utilities
Developer Tools
Oracle Questions?
Oracle News
Search This Site
About Us
Disclaimer
Privacy Policy
Contact Us
leftimage for asktheoracle.net

Oracle SQL Tutorial -
How To Make Your SQL Lightning-Fast

Tip #7 - Name the Required Columns In SQL Queries

Tip #7 in this Oracle sql tutorial is to name the columns in a query instead of using "select * from ..." to indicate all the columns should be selected even if all the columns are needed.

There are (at least) three good reasons for this:-

  1. Network traffic is reduced. This can have a significant impact on performance if the table has a large number of columns, or the table has a long or long raw column (both of which can be up to 2 Gigabytes in length) or LOBs (which can be up to 3 gigabytes in size). These types of columns will take a long time to transfer over the network and so they should not be fetched from the database unless they are specifically required.

  2. The code is easier to understand, which means you need fewer comments and maintenance will be faster and therefore cheaper

  3. It could save the need for changes in the future. Not only might columns be added to or removed from the table or view, but the order of the columns could well change (unlikely in a table but not impossible) - in which case using "SELECT *" at best would fetch the wrong data and at worst would fail with an Oracle error which might take a long while to understand.

To learn more about Oracle, contact Smartsoft Computing for Oracle training in the UK and Oracle training and consultancy in New Zealand.

Return to Oracle SQL Tutorial part 1