RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: SQL
Expertise: Beginner
Oct 17, 2019

3 More Hints for Building Faster SQL Queries

For building faster SQL queries, follow these hints.

  1. 1. Use Smaller batches

    Always try to delete data or update data in smaller batches. If you try to delete thousands of records in one go, it will impact performance. If you try to update large batches of data in one go, it will also negatively impact performance and speed. Break these up in smaller chunks.

  2. Stop being trigger-happy!

    By using triggers, you may end up locking more than one table at the same time, until the trigger has completed its work. Sometimes a trigger is unavoidable, but only sometimes. Rather, try to split the logic so that only limited resources are locked at a given time.

  3. Avoid nesting views

    As the name implies, nested views are views inside existing views. The more nested a view becomes, the more data has to be returned for a single query and this can really cause your whole database to lag quite quickly. Do not nest views.

Hannes du Preez
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date