Performance

 | Glossary ->

Result set column

It is not recommended to use * in a SELECT clause, due to performance issues. You should only return columns you want to use. As a consequence, you should replace any count(*) by a count on one column only.

Avoid the value expressions

Whenever it is possible, avoid the use of value expressions in the WHERE clause like this:

1 SELECT id_reunion
2 FROM reunion
3 WHERE duration - 60 <= 0;

It forces the rDBMS to compute the value for each line, which is very expensive. You should rather compute yourself the values with literals (0 + 60 in this case):

1 SELECT id_reunion
2 FROM reunion
3 WHERE duration <= 60;

Index

If you often select records sorting or filtering by a given column, you may add an index on this column. The database behavior should not change. The index may make query faster. However, don't add useless indexes as it makes insertion a little bit slower.

The exhaustive syntax of the CREATE statement for the indexes is as follows:

1 CREATE[ UNIQUE] INDEX <index name> ON <table name> (<column name>[, <column name>]*);

The keyword UNIQUE indicates that all the group of values in the columns must be distinct.


  This article uses material from the Wikipedia page available here. It is released under the Creative Commons Attribution-Share-Alike License 3.0.

Structured_Query_Language/Performance
 



 

Connect with defaultLogic
What We've Done
Led Digital Marketing Efforts of Top 500 e-Retailers.
Worked with Top Brands at Leading Agencies.
Successfully Managed Over $50 million in Digital Ad Spend.
Developed Strategies and Processes that Enabled Brands to Grow During an Economic Downturn.
Taught Advanced Internet Marketing Strategies at the graduate level.


Manage research, learning and skills at defaultLogic. Create an account using LinkedIn or facebook to manage and organize your Digital Marketing and Technology knowledge. defaultLogic works like a shopping cart for information -- helping you to save, discuss and share.

Visit defaultLogic's partner sites below:
PopFlock.com : Music Genres | Musicians | Musical Instruments | Music Industry
NCR Works : Retail Banking | Restaurant Industry | Retail Industry | Hospitality Industry

  Contact Us