Skip to Main Content
Feature Request FR-4725
Product Area SQL Workshop
Status OPEN

1 Voters

Improve SQL commands/workshop: large-query blocks don’t work/write correctly and with large data there’s lag/no correct summary.

mubshirakram52 Public
· Nov 20 2025

Idea Summary

I propose a SQL Performance Diagnostic & Optimization Tool embedded within Oracle APEX’s SQL Workshop or Builder. It addresses the problem of very large SQL query blocks (or data-intensive queries) that cause APEX to hang, run slowly, or not return correct summaries. The tool will analyze query text, identify common performance anti‑patterns, and guide developers toward optimized SQL. It should also integrate with APEX’s built‑in monitoring (Top SQL) to allow direct tuning of problematic queries without leaving the APEX workspace.

Use Case

Heavy Reports: Developers have pages (Interactive Reports, Grids, Classic Reports) that query hundreds of thousands of rows, leading to long load times or freezing.

Large SQL Blocks: There are large, complex SQL statements (with nested sub‑queries or PL/SQL) that are hard to optimize by hand.

Limited DBA Access: Developers don’t always have access to deep database tuning tools or DBA privileges, so they need performance advice within APEX.

Performance Feedback Loop: Users complain about slowness or incorrect summary data; developers need a way to correlate those complaints with specific SQL and fix them.

Continuous Optimization: Over time, data grows and queries degrade; a built‑in tool helps catch and tune slow SQL before it becomes a severe user‑experience issue.

Preferred Solution (Optional)

Here’s how this idea could be implemented:

SQL Analyzer Module

Add a button (“Analyze / Tune SQL”) in SQL Workshop’s command editor.

When clicked, the module parses the SQL text and runs heuristics to detect anti‑patterns:

SELECT * usage

Use of functions (or v(…)) in WHERE clause (which may prevent index usage)

Very large nested sub‑queries or DISTINCT / aggregation over huge data sets

Lack of bind variables (or usage of substitution instead)

Provide warnings and advice based on the analysis.

Explain Plan Integration

Use APEX’s built‑in “Explain” feature in SQL Workshop to generate the execution plan.

Highlight expensive operations (e.g. full table scans) visually (e.g. red for unindexed columns) — similar to how “Top SQL” shows them.
Oracle Documentation

Provide quick links to each table or index in the plan so developers can inspect schema.

Optimization Recommendations

Based on analysis + plan, suggest actionable steps:

Add or modify indexes on columns used heavily in filters/join/order.

Rewrite sub‑queries into CTEs or joins.

Use bind variables instead of substitution string or v(…).
Laureston

Use APEX region caching for heavy report regions where data doesn’t change on every request.

Consider storing results into an APEX collection to avoid re‑running expensive queries for pagination.
Oracle Documentation

Monitoring Dashboard

Provide a “Slow SQL / Performance” dashboard in APEX Builder (or workspace) that shows:

Top slow queries (by average execution time or frequency) — using APEX’s Top SQL utility.
Oracle Documentation

Link feedback (if any) from end‑users to specific SQL statements or pages.

Allow developers to re-run “analyze / tune” after making changes and compare performance (before vs. after).

Education / Best‑Practices Guidance

Embed a mini “SQL Tuning Guide” inside APEX (SQL Workshop) that shows best practices: using bind variables, avoiding dynamic / function-heavy WHEREs, when to use caching, etc.

This idea is open.