logo for asktheoracle.net
Home
What's new?
Oracle Tutorials
PL/SQL
SQL
Oracle Tips & Tricks
Advanced Tutorials
Certification
Oracle 10g
Oracle 11g
Oracle and .Net
Oracle Tools
Disclaimer
Privacy Policy
Search This Site
Oracle Questions?
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