Skip to end of banner
Go to start of banner

Fine-Tuning Your SQL Query

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

This article provides guidance to help you resolve issues encountered during SQL queries and offers insights on fine-tuning SQL queries effectively.

1. Aliasing Issue in Query

At times, when executing SQL queries containing aliases in an SQL Integrated Development Environment (IDE), users may encounter challenges. This often occurs as depicted in the example below:

In such instances, the recommended approach is to run the query without aliasing, as illustrated below. Removing the aliases can enhance the query's compatibility and ensure smooth execution.

SELECT
    pp.username ,
    pp.pagename ,
    pp.id,
    COUNT(pc.portalpage) AS dataplane_gadgets
FROM
    portletconfiguration pc
LEFT JOIN
    portalpage pp ON pc.portalpage = pp.id
WHERE
    pc.gadget_xml LIKE '%dataplane%'
GROUP BY
    pp.username, pp.pagename, pp.id
ORDER BY
    pp.username, dataplane_gadgets DESC;

2. Query taking longer time to execute

2.1. Explain Analyze

2.2. Dead Tuple

  • No labels