Skip to main content
Skip table of contents

Optimise SQL Results

We have a limitation on the database response size. To optimise the results, consider implementing the below tips:

  1. Select Only Required Columns
    Avoid usingSELECT*. Use more specific queries to pull data efficiently. For example:

CODE
SELECT column1, column2 FROM table; 

  1. Use Variables
    Leverage our app's feature of using variable to fetch targeted data effectively. For example:

SQL
SELECT column1, column2 FROM table WHERE customer_id = {varCustomerId};

  1. Filter Data with WHERE Clauses
    ApplyWHEREclause which helps to filter the data and reduce unnecessary data retrieval For example:

CODE
SELECT column1, column2 FROM table WHERE condition;

  1. Use LIMIT to Reduce the Number of Rows
    By using LIMIT (or its equivalent), you can restrict the result size and fetch certain number of records. This is especially useful when displaying paginated results. For example:

CODE
SELECT column1, column2 FROM table LIMIT 100;

  1. Avoid Wildcards
    Avoid using wildcards (%at the start) in LIKE patterns, as they prevent the database from using indexes. For example:

CODE
SELECT name FROM employees WHERE name LIKE 'John%'; 

  1. Use DISTINCT to Eliminate Duplicate Rows

If you know your query may return duplicate rows, use the DISTINCT keyword to remove them.
For Example:

CODE
SELECT DISTINCT department FROM employees;

  1. Select only the required fields. Ensure that you are only selecting the fields necessary for your task, which will make the retrieved information more useful and concise.

Implementing these strategies will significantly reduce the response size and improve performance.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.