Oracle APEX Performance Tuning: How to Find and Fix Slow Pages
A practical method for fixing slow Oracle APEX pages: measure with debug and the activity log, tune region SQL with bind variables and execution plans, limit report rows, use lazy loading and region caching, and keep LOVs and processes light.
Oracle APEX
Oracle APEX Performance Tuning: How to Find and Fix Slow Pages
“The system is slow” is the most common complaint about any business application, and Oracle APEX applications are no exception. The good news is that APEX itself is rarely the problem. In almost every slow page I have investigated, the time was spent in one of a few places: a region query that reads far more data than it shows, a function called once per row, a list of values that runs a heavy query, or a process doing row-by-row work. APEX gives you the tools to find out which one – you just need to measure before you change anything.
This guide is a step-by-step method that works on APEX 19c and later, from measuring a slow page to the specific fixes that usually make the biggest difference.
1. Measure first: which page, which component, how slow?
Start with facts, not guesses. Users often say “everything is slow” when one dashboard or one report page is the real problem.
Use the activity log to find the slowest pages
APEX records every page view with its elapsed time. Query the workspace activity view to see which pages are actually slow and how often they are used:
SELECT application_id,
page_id,
page_name,
COUNT(*) AS views,
ROUND(AVG(elapsed_time), 2) AS avg_seconds,
ROUND(MAX(elapsed_time), 2) AS max_seconds
FROM apex_workspace_activity_log
WHERE view_date >= SYSDATE - 7
AND application_id = :APP_ID
GROUP BY application_id, page_id, page_name
ORDER BY avg_seconds * COUNT(*) DESC;
Ordering by average time multiplied by views puts the pages that waste the most user time at the top. A page that takes 6 seconds but is opened twice a week matters less than a page that takes 2 seconds and is opened 3,000 times a day.
Use debug mode to find the slow component
Open the slow page with debugging enabled (from the developer toolbar, or by setting debug to LEVEL9 in the URL while developing). Then view the debug messages and look at the elapsed-time column. Each region, computation, process and validation is logged, so a jump from 0.3 seconds to 4.8 seconds tells you exactly which component consumed the time.
For your own PL/SQL, add messages with apex_debug.message or apex_debug.enter so the timing of long procedures also appears in the log. These calls cost almost nothing when debug is off.
2. Tune the region SQL
Once you know the slow region, copy its query into SQL Developer or SQL*Plus, run it with realistic bind values and look at the execution plan:
SELECT /*+ gather_plan_statistics */ ...your region query...;
SELECT *
FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL, NULL, 'ALLSTATS LAST'));
Compare estimated rows (E-Rows) with actual rows (A-Rows). Large differences usually mean stale statistics or a predicate the optimizer cannot estimate. Full scans of large tables where you expected an index lookup are the next thing to check.
The most common SQL problems in APEX pages are:
- Using
v('P1_ITEM')instead of bind variables. In region SQL always reference items as:P1_ITEM. Thev()function is called for every row it is evaluated against and hides the value from the optimizer. - Functions on indexed columns.
WHERE TRUNC(invoice_date) = :P1_DATEcannot use a normal index oninvoice_date. Rewrite it as a range:invoice_date >= :P1_DATE AND invoice_date < :P1_DATE + 1. - Optional filters written with
OR. Conditions like(:P1_CUSTOMER IS NULL OR customer_id = :P1_CUSTOMER)are convenient but can lead to poor plans on large tables. For the heaviest pages, consider separate queries or a PL/SQL function returning SQL so the common case gets a clean predicate. - Scalar subqueries and PL/SQL functions in the select list. A function that looks up a customer name for each of 50,000 rows runs 50,000 times. Replace it with a join, or at least make sure the report only fetches the rows it displays.
3. Do not fetch rows nobody will see
Interactive Reports, Interactive Grids and Classic Reports only display one page of rows, but some settings force the database to process everything:
- Pagination that shows the total (“Row X to Y of Z”) requires counting every row. On large tables, choose a pagination type that does not need the total count.
- Set a maximum row count on Interactive Reports. Users rarely need to scroll through 200,000 rows; they need good filters.
- Require a filter on huge tables. A report on all stock movements since 2015 should open with a date range of, say, the last 30 days, not the whole history.
- Aggregate in SQL, not in the browser. Dashboards should query summary views or materialized views, not raw transaction tables. See our guide to building KPI dashboards in Oracle APEX.
4. Load what users see first
A page with eight regions renders only when all eight have finished. Two features help:
- Lazy loading. Regions that support it (such as classic reports, cards and charts in recent APEX versions) can render the page first and load their data afterwards, so the user sees the page immediately.
- Region server cache. For data that changes slowly – a monthly sales summary, a list of branches – region caching can store the rendered output for a set period, by user or by session. Use it only where slightly old data is acceptable, and set a sensible timeout.
Also consider moving rarely used regions to a separate tab, a modal page or a drill-down. A dashboard with fewer, better regions is usually both faster and more useful.
5. Check lists of values and page items
Popup LOVs and select lists execute their own queries, often on every page load. A select list built on a customer table with 80,000 rows will slow down every page it appears on.
- Use a Popup LOV with search for large lists instead of a select list.
- Make sure the LOV query filters on indexed columns and does not call functions per row.
- For cascading LOVs, set the parent items correctly so the child LOV runs only when needed.
- Remove computations that run “Before Header” on every page load but are only needed in one case – add a server-side condition instead.
6. Make page processes and Ajax callbacks efficient
Slow saves are usually slow PL/SQL. Common causes are loops that update one row at a time, commits inside loops, and triggers that do heavy work on each row. For batch work, use set-based SQL or BULK COLLECT and FORALL. For long-running jobs – month-end posting, payroll calculation, large imports – run them in the background with a scheduler job or APEX background processing (available in newer APEX versions) and show the user a status, instead of making the browser wait.
Dynamic Actions that call the server on every key press or every change of a field can also add up. Check the network tab in the browser’s developer tools: if one page fires twenty Ajax calls, combine them or trigger them only when needed. Our guide to APEX Dynamic Actions covers the common mistakes.
7. Do not forget the database and the web tier
If every page is slow, not just one, look beyond the application:
- Optimizer statistics must be current. Large data loads without fresh statistics are a classic cause of sudden slowness.
- ORDS connection pool settings should match the number of concurrent users; a pool that is too small makes users queue.
- Static files (JavaScript, CSS, images) should be minified and served with caching headers, ideally from the web server rather than from database tables.
- Network latency matters for users in remote branches. Large pages with many images feel slow on weak connections even when the database is fast.
8. Prove the improvement
After each change, measure again with the same activity log query and the same debug trace. Keep a simple record: page, average time before, change made, average time after. It shows the business what was fixed and stops “the system is slow” from becoming a permanent belief after the problem is gone.
Quick checklist
- Slowest pages identified from
apex_workspace_activity_log - Slow component found with debug elapsed times
- Region SQL uses bind variables, not
v(), and has a sensible execution plan - No functions on indexed columns in
WHEREclauses - Reports limited by default filters and maximum row counts; no total-row counts on huge tables
- Lazy loading or region caching where appropriate
- Large LOVs converted to searchable Popup LOVs
- Heavy processing moved to set-based SQL or background jobs
- Statistics, ORDS pool and static file caching checked
Related guides: Interactive Grid validation and PL/SQL processing, SQL vs PL/SQL and PL/SQL error logging.
Next step for busy systems: once single pages are fast, spread the load across servers with our Oracle APEX load balancing guide (ORDS + Nginx).
APEX pages still slow?
Get your Oracle APEX application tuned by a certified APEX developer
AbairTech finds and fixes slow APEX pages, SQL and PL/SQL, and builds new APEX applications. 12 years of Oracle experience, Top Rated on Upwork, remote worldwide.
Need help with a slow APEX application?
AbairTech tunes and develops Oracle APEX applications, PL/SQL and Oracle Database systems for ERP, POS and HR workloads.
Related implementation services
Need help applying these concepts in a business system? Explore Oracle APEX development services or Oracle Database and PL/SQL services.