Tuning OpenEMR performance and audit log volume

Find the cause of a slow self-hosted OpenEMR in the database, audit log, session store or web tier, then tune each without weakening the audit trail your certification and HIPAA duties depend on.

On this page

Why a slow OpenEMR usually traces back to the database and audit log

When a clinic's OpenEMR slows down as its tables grow, the instinct is to add CPU or move to a bigger server. Tuning starts somewhere else: with measurement of the database, the audit log tables, session handling and the web tier, in that order of likelihood. Changing configuration before you know which layer is slow usually moves the problem rather than fixing it. OpenEMR is a free, open-source electronic health records and medical practice management application with scheduling, billing and internationalization, licensed under the GNU GPL v3.0. Recent releases require PHP 8.3 or later and run on a MySQL- or MariaDB-compatible database, and the project offers Docker deployment options. Every one of those layers is yours to operate when you self-host it.

A tuning project is the right step when the slowness is specific and reproducible: a few screens or reports are slow, query time grows with record count, or the database and audit tables are large relative to what the server was sized for. A hardware or hosting change is the right step when measurements show the database server is saturated on CPU, memory or disk I/O across normal work, and the schema and queries are already reasonable. Exact performance thresholds depend on your environment, including user count, record volume, hardware, storage and network path, so none of them can be quoted in advance. Confirm the baseline on your own system before deciding. Also confirm which OpenEMR version and PHP version you run, because upgrade paths change what can be tuned.

Before anyone edits a setting, capture the slow pages, the slow queries on the database server, the size and growth rate of the audit log tables, session storage behavior under concurrent users, and web server and PHP-FPM response times for the same period. Plan the work with the compliance owner in the room, because audit logging is tied to your certification and HIPAA obligations and any change to what gets logged or how long it is kept is a governance decision as well as a performance one. The sections that follow cover each layer in turn, starting with the database.

How clinical requests, sessions and audit writes reach the database

The diagram starts with a clinician's browser request passing through the web server and the PHP application. The application reads and writes session state in a session store, and each clinical action also writes an audit record to the same MySQL or MariaDB database. Reports and background jobs read those same tables, so the database is the shared point of contention. When you tune, check the audit tables first, because they grow with every action and never shrink on their own.

Requests, sessions and audit writes all converge on one database.

Where OpenEMR slowdowns usually come from

A slow OpenEMR usually traces back to a small set of sources: the database, the audit log, sessions, the web and PHP tier, heavy queries and scheduled work. Each one shows up differently to clinic staff, and each has a first check that narrows the search before any change is made.

Database sizing and indexes

Clinic staff notice slow chart loads, schedule views that take long to render and searches that stall at busy times of day. The database may be undersized for the working set, or queries may scan large tables because an index is missing or not used. Run the slow query log on the MySQL or MariaDB server during a slow period and check the execution plan for the top queries. Confirm the cause by measurement in your environment before adding or dropping indexes.

Growing audit log tables

Over months, the audit tables can grow faster than the clinical data they describe, and reports or patient lookups that touch them slow down. Staff may notice that some screens are fine while others, especially those that read history, lag. Check the row counts and on-disk size of the audit-related tables and compare growth over time. Any change to what is logged or how long it is kept must be weighed against the audit obligations your compliance team has set.

Session storage

Sessions that are stored in files or in a database table can accumulate stale entries, and lookups on every request then get slower. Users may see random logouts or pages that hang briefly on each click. Check where PHP stores session data, how many session records exist, and whether old sessions are being cleaned up on schedule. Confirm the storage location and cleanup behavior against your own installation before changing it.

PHP and web server resources

Slowness that affects every page at once, especially under concurrent use, often points to PHP worker limits, memory limits or an undersized web tier. Staff see pages that load slowly for everyone at the same time rather than for one screen. Review PHP-FPM or Apache worker counts, memory limits and CPU and memory use on the host during peak use. Confirm whether requests queue at the web server before changing any setting.

Large document and report queries

Printing a long chart, generating a large report or opening a patient with many scanned documents can hold resources for a long time. Users notice that one action freezes the session while others continue normally. Identify which pages generate the slow requests from the web server access log, then time those requests separately. Check whether the document storage is on a slow disk or network share before drawing conclusions about the application.

Background and scheduled jobs

Cron jobs, reconciliation tasks and report generation that run during clinic hours compete with interactive users for the database and CPU. Staff notice slowness at the same time each day or week. List every scheduled job on the host and the database server, then compare their start times with the slow periods in your monitoring data. Confirm the overlap before moving any job, and test the change in a non-production copy first.

Audit log and session settings and when each fits

This table compares the settings that drive OpenEMR database load and log growth, from audit logging in Administration Globals to session storage, retention and indexing. Read each row as a question: what the setting controls, when changing it fits, and what the change costs in compliance evidence or troubleshooting ability. The main takeaway is that audit logging is usually the last setting to reduce, and only after a documented compliance decision.

Setting areaWhat it controlsWhen it fits and the trade-off
Audit log recording in Administration GlobalsWhich events OpenEMR writes to its audit log, such as logins, record views and changesConfirm the exact setting names and defaults for your version in the Administration Globals wiki first. Reducing event types cuts row growth but removes evidence an assessor or incident responder may ask for, so no event type should be turned off without a documented compliance decision.
Audit log query and display settingsHow much audit data the user interface loads and how far back searches runLimiting default query ranges or result counts can ease slow audit screens without changing what is recorded. The trade-off is that investigators must request wider ranges deliberately, so document the procedure for doing so.
Session storage locationWhere PHP session data lives, such as local files or a shared storeMoving sessions to a shared or faster store helps multi-server or container deployments where sessions must survive a restart or load balancer move. Local file storage is simpler to run, but it can behave inconsistently across nodes, so confirm the approach against your deployment guide.
Database retention or archiving of audit dataHow long audit rows stay in the live database before they are copied out or removedArchiving old audit rows to separate storage keeps the live tables small, but the archive must remain searchable and retained for the period your policy requires. Deleting rows early can conflict with retention obligations, so set the period with compliance and legal owners.
Database indexingHow the database locates rows for patient, encounter, user and audit queriesAdding indexes can speed slow reports and searches, but each index adds write cost and disk use. Test changes on a copy of production, record the query plan before and after, and check that OpenEMR upgrades do not drop or conflict with custom indexes.
Database sizing and buffer capacityMemory and storage available to the database for caching and table growthAdding memory or faster storage often helps when working sets exceed available cache. Confirm sizing with your database vendor documentation and monitor growth rates before buying capacity, since cost depends on your hosting model.
Growing log and table monitoringSize and growth trend of audit, session and log tables over timeTracking table size and growth rate shows whether a tuning change is needed or whether retention is simply missing. Without this baseline, teams often tune queries when the real problem is unbounded growth.

Audit log volume and the certification trade-off

Audit logging is part of what OpenEMR must record for certified use and for the HIPAA technical safeguards, so trimming audit data is a compliance decision, not only a performance one. Before you change any audit setting, pruning a table, or reducing what is logged, establish which obligations apply to your deployment. OpenEMR 7.0.0 was ONC certified as a 2015 Edition Base EHR, and the OpenEMR website tells users to upgrade to version 8 by March 1, 2026 to keep their system's active certification. If your practice relies on that certification for its own reporting or contracts, the audit configuration you run is part of what the certification describes, and a change that reduces logging may move you outside it. The HIPAA Security Rule also expects covered entities and business associates to track activity on systems holding ePHI, and your risk assessment should describe how audit records are kept and reviewed.

The trade-off belongs to your compliance owner, not to the team tuning the database. Ask them to decide which audit events must be retained, for how long, and who may review them, and record that decision in your risk assessment. Then ask your certification or compliance adviser to confirm, in writing, which audit settings and retention changes are permitted for your version and certification status. Do not assume that a setting exposed in the administration screens is safe to change in a certified environment. Ask for the answer per setting, because some events may be required while others are optional.

When the log tables are large, archiving with retention controls usually fits the obligations better than deletion. Move older audit rows to a separate store, keep them readable and tamper-evident for the period your owner sets, and document the procedure, including who can restore them for an inquiry. Test a restore before you rely on the archive. This keeps the live tables small enough to query quickly while preserving the record. Any archive job should be scheduled and monitored like a backup, and it should be covered by the same access controls as the source data.

Tuning by deployment: single server, Docker or multisite

On a single self-hosted server, the web server, PHP runtime, database and sites directory usually share one host, so every tuning change competes for the same CPU, memory and disk. The database normally runs on the same machine or on a dedicated database host that you manage, and PHP sessions are typically stored on local disk unless you have configured otherwise. The sites/ directory holds the configuration and the documents tree, so its disk I/O and free space affect page loads and uploads as well as the database.

  • Database placement: Confirm whether MySQL or MariaDB runs locally and how much memory is reserved for its buffer pool relative to PHP and the web server.
  • Session storage: Check where PHP session files are written and whether that path is on the same disk as the database and documents.
  • Sites directory growth: Track the size of sites/ over time, since scanned documents and uploads grow with the practice.
  • Log and slow query location: Identify where the slow query log and audit tables are written, and whether they share a disk with the database data files.
  • Shared resource limits: Test PHP worker counts against available memory so that a burst of requests does not push the database into swapping.

After each change, measure page response times and database load on this host before and after, because a single server hides the cause of contention.

How to tune OpenEMR performance in the right order

This sequence moves from a verified version baseline to measured bottlenecks, then to audit and session settings chosen under a documented compliance decision. Each change is re-measured so the team can show what improved and why.

  1. Confirm version, PHP and database versions

    The administrator records the running OpenEMR version, the PHP version and the MySQL or MariaDB version, and compares them with the requirements in the current release notes. Recent OpenEMR releases require PHP 8.3 or later and run on a MySQL- or MariaDB-compatible database, so older runtimes are a common cause of slowness that tuning cannot fix. Check the version against the latest security releases on the OpenEMR releases page. Done means a written inventory, with versions pulled from the server and database, sits in the change record and matches the supported combination.

  2. Baseline response time and database load

    Measure page response times and database load during a normal clinic hour, not an idle period or a maintenance window. Capture the main workflows, such as opening the schedule, loading a patient chart and saving an encounter, along with PHP worker use, database connections and CPU or memory on each host. Repeat the capture on at least two working days so one unusual afternoon does not drive decisions. Done means a dated baseline table exists that the team can compare against after every change.

  3. Review slow query logs and table growth

    Enable or review the database slow query log for the same clinic hour, then group the slowest statements by table and query pattern. Record the size and row count of the largest tables, with particular attention to audit and log tables, which grow with every logged action. Ask the database team which logs are already retained and for how long before changing anything. Done means a ranked list of slow statements and a growth trend per large table, which tells you whether the problem is query shape, data volume or both.

  4. Check indexes and database sizing

    For each slow statement from the previous step, review the execution plan and confirm whether it uses an appropriate index. Consider adding or adjusting indexes only after testing them in a non-production copy, because extra indexes slow writes and increase storage. Compare the database memory and storage allocation with the working set and the growth trend, and confirm the configuration with your DBA and the OpenEMR upgrade notes for the version in use. Done means each index change is tested, documented and matched to a measured query, and the sizing decision is written down with its evidence.

  5. Set audit and session settings after the compliance decision

    Audit logging and session storage affect both performance and evidence, so set them only after the compliance lead records what must be logged, for how long and who may view it. Settings that reduce logging detail may conflict with certification or HIPAA risk analysis requirements, so confirm the trade-off with your compliance advisor before making any change. Session storage should be reviewed against the number of concurrent users in the baseline. Done means a signed decision record lists each audit and session setting, the reason for it and the approver.

  6. Archive or purge audit data under retention policy

    Remove or move old audit rows only under a written retention policy approved in the previous step, and export the data to protected storage before deleting anything. Run the purge in a maintenance window, using a tested script or procedure, and keep a record of the row counts and date ranges removed. Confirm that backups taken before the purge still meet your retention obligations. Done means the audit table size and row count match the policy, the archive restores correctly in a test, and the purge is logged.

  7. Re-measure and document the change

    Repeat the baseline measurements from the same clinic hour and the same workflows, then compare the results with the original numbers. Record each change, its measured effect and any regressions in the change log, and note anything that did not improve so the next person does not repeat the same test. Schedule a follow-up review of table growth and slow queries. Done means a before and after report exists, each change is linked to a measured result, and the team has an agreed next review point.

Security and operational risks of changing audit or session settings

Audit logs and session storage are where HIPAA technical safeguards show up in day-to-day OpenEMR operation, so tuning them carries compliance risk as well as speed gains. The cards below describe the failure modes that appear most often when a slow system is changed in production, and what to verify in a copy before any change goes live.

Losing audit evidence during pruning

Trimming audit tables to recover space removes the record that shows who viewed or changed ePHI. The HIPAA Security Rule's audit controls standard in 45 CFR 164.312 expects you to record and examine activity in systems that contain ePHI, so retention is a safeguard decision, not only a storage decision. Before pruning, confirm your retention period with your compliance lead, export the rows you must keep to archive storage, and test that the archive is readable. Illustrative example: a nightly delete job that runs without an archive step can erase the only evidence for a disputed access.

Security Rule text

Unsupervised logging changes in production

Changing audit logging settings directly on a live clinic system can silently reduce what gets recorded. A toggle that lowers detail for a query or event class may look like a harmless speed fix, yet it changes the evidence your team relies on during an investigation. Record every setting change with its owner, date, and reason, and require sign-off from security and compliance. Compare the audit configuration in the copy against production before and after each change so drift is visible.

Session storage moving to a weaker location

Moving PHP sessions to a shared cache, a file path, or a host with looser access can expose authenticated sessions to other processes or tenants. Technical safeguards cover automatic logoff and access control, so a session store must keep session data private, expire it on schedule, and remain reachable only by the OpenEMR application. Check file permissions, network exposure, and encryption in transit for any new store. Verify logoff behavior in the copy by confirming that an idle session ends and cannot be reused.

Database changes that break backups

Partitioning, moving tables, or changing storage engines can leave a backup job unable to capture the full database or produce a dump that fails to restore. Backup and recovery support the contingency planning standards, and an untested restore does not prove recovery. After any schema or indexing change, run a backup, restore it to a separate host, and open a patient record and an audit report from the restored copy. Keep the backup scripts and the database version in the change record.

Index changes without a rollback plan

Adding or dropping indexes directly on a production database can lock tables, slow writes, or change query plans in ways that were not visible in testing. Each change should carry a tested reverse statement, a maintenance window agreed with clinical operations, and a timing measurement taken on the copy with production-sized data. Record the index names and definitions before the change so you can restore them exactly. Ask your database administrator to confirm how long the table lock will last on your engine and version.

Performance changes that alter behavior after upgrades

Custom query tweaks, cache settings, or local patches applied to speed up OpenEMR can be overwritten or conflict with a new release. A later upgrade may restore default audit or access behavior, or leave a patched query returning different results. Keep every tuning change in version control with a written reason, and re-test audit logging, access control, and session timeouts after each upgrade. Check the release notes for the version you are moving to before you schedule the upgrade in the copy.

Limits to confirm before changing audit settings

Before you change any audit setting on a slow OpenEMR, confirm what that setting does in your exact version, because audit behavior is the part of the stack most likely to differ between releases and deployment methods. Check the audit-related entries on the Administration Globals screen against the Administration Globals reference for your version, record the current values, and test any change in a copy of production first. Also confirm whether your deployment is Docker, a package install or a custom build, since the location of the configuration and the way changes persist can vary.

Next, confirm the database engine and version you run. OpenEMR's recent releases support MySQL- or MariaDB-compatible databases, but index behavior, query planner features, online schema change support and the options available for partitioning or archiving differ between them. Ask your DBA which features your engine and version actually provide, and whether your team has a tested rollback for index and table changes. Also confirm how upgrades treat custom indexes: a new release can add or alter tables, so every index you add must be listed, scripted and re-verified after each upgrade, and you should not assume an upgrade will keep it.

Finally, confirm the retention rules that apply to you. Ask your compliance lead and any certification or risk assessment owner whether audit records must be kept for a set period, whether they must be complete, and whether any reduction in logging changes your evidence. No general figure for how large audit tables can grow, or how quickly queries degrade, is given here. Measure both on your own hardware with production-like data, and check the results against your vendor documentation and your written retention requirements before you decide what to keep, archive or trim.

Questions buyers ask before hiring help with OpenEMR performance

How much does OpenEMR performance tuning cost?

DeployOpen does not publish a price list. A quote follows from a written scope, and the main cost drivers are the size of that scope, the number of environments involved, how deep the measurement goes, and the change window you can offer. A fix limited to one slow report costs less to scope than a review that profiles web, PHP, database and session behavior across production and a test copy. Measurement depth is often the largest variable: a baseline with before and after timings needs more effort than a single targeted change. Most tuning work is one-time, but log retention settings and periodic review of table growth recur. When you request a quote, ask for the environments covered, the measurements taken, the changes planned, the retest steps and any recurring items listed separately.

How long does it take to fix a slow OpenEMR?

Duration depends on how quickly the slowdown can be reproduced, how large the database is, how many environments must be changed and tested, and how often you can open a change window. Work usually moves faster when a recent copy of production is available for testing, because database changes such as new indexes need to be checked against realistic data before they reach live patient records. Delays tend to come from waiting for approvals, scheduling downtime or repeating tests after a change does not behave as expected. Ask for the timeline in the written scope, and confirm which steps depend on your staff, such as access grants, sign-off on clinical workflows and the change calendar.

What does our clinic need to provide for a tuning engagement?

Four things determine whether the work moves smoothly. First, access to the servers, database and web logs, with credentials limited to what the work requires. Second, a test copy of the OpenEMR database and sites directory, ideally restored from a recent backup, so changes are checked before production. Third, change windows agreed in advance, including a rollback plan and someone available during each window. Fourth, decisions from your compliance owner about audit log settings and retention, because those choices affect evidence you may need later. Clinical staff should also be available to confirm that tested workflows still behave correctly after changes.

Can an internal OpenEMR administrator tune performance alone?

An experienced administrator can handle some tuning tasks alone, especially checking the running PHP version against the OpenEMR release notes, reviewing slow query logs and confirming that the web and database servers have adequate resources. Recent OpenEMR releases require PHP 8.3 or later and a MySQL- or MariaDB-compatible database, so version alignment is a sensible first check. Index changes, schema-level changes and audit setting changes carry more risk because they affect data integrity and evidence. Before deciding, confirm that your team has database tuning experience, a test environment, a change process and someone who can judge the compliance impact. Many organizations split the work, keeping routine checks in-house and bringing in help for the database and audit decisions.

Can we reduce audit log volume without weakening our audit evidence?

Sometimes, but only after the compliance owner agrees to the specific change. The HIPAA technical safeguards in 45 CFR 164.312 include audit controls, and the Security Rule does not require certification of compliance (HHS FAQ 2003). OpenEMR's website states that the software is ONC certified and told users to upgrade to version 8 by March 1, 2026 to keep their system's certification active. Turning off or thinning events may conflict with the certification configuration or with what an auditor expects to see. Safer options usually include better indexes for the audit queries, archiving older rows to a separate retained store with integrity checks, and documented retention periods. Keep a record of every setting change, its reason and who approved it.

How does DeployOpen quote an OpenEMR performance engagement?

DeployOpen quotes from a written scope. Most engagements are fixed-scope, so the scope, deliverables and timeline are agreed in writing before work starts. Expect the quote to list the environments in scope, the measurement and profiling tasks, the specific tuning changes proposed, the testing and retest steps, the change windows required and the handover documentation. Items that continue after the project, such as ongoing monitoring reviews or upgrades, should appear as a separate retainer rather than being mixed into the one-time work. Ask for assumptions in writing, including what you must provide, so you can compare quotes from other providers on the same basis.

Which OpenEMR areas should we check first when pages load slowly?

Check in an order that separates cheap, low-risk checks from changes that touch data. Start with the PHP version, server resources and the web server configuration, then review the database slow query log to see which queries dominate load. Next, confirm that session storage is not a bottleneck and that the sites directory and log tables are not growing without limit. Audit log tables often grow quickly, so check their row counts and size alongside the indexes used by the audit queries. Only after this baseline should you propose index or schema changes, tested on a copy of production first. Record each measurement so you can show what changed and why.

How DeployOpen works on this

DeployOpen starts a performance engagement by measuring where your OpenEMR installation slows down, then agrees a written scope before any change is made. The work runs inside your own infrastructure, with each change tested, documented and handed to your team with the reasoning behind it.

How we scope

  • Review the current OpenEMR version, PHP version, database engine and hosting layout before agreeing any tuning work.
  • Agree in writing which audit log settings will change and which compliance owner must approve each change.
  • Define the slow pages, reports and session behavior in scope, with the measurements that will prove each fix worked.
  • Engagements are fixed-scope, so deliverables and timelines are set in writing before work starts.

How we build

  • Capture baseline query timings, table sizes and session counts in a staging copy that matches production.
  • Test index changes and database configuration in staging, then apply them in production in a planned window.
  • Set audit log retention and rotation rules with a documented rollback for each change.
  • Run load and regression checks on the clinical workflows your staff use most often before sign-off.

How we hand over

  • Deliver a runbook that records each setting changed, its previous value, and the reason for the change.
  • Document the audit log trade-offs so your compliance lead can confirm the retention position in writing.
  • Walk your administrators through the monitoring queries used to detect table growth and slow queries.
  • Provide a retest report that compares before and after measurements against the agreed baseline.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer after the initial engagement.
  • Retainers can cover re-checking performance after each OpenEMR release and each database or PHP upgrade.
  • Ask any provider to confirm how they will handle audit log retention changes that your compliance program depends on.
  • Confirm in the quote which environments, reviews and retest cycles are included and which are billed separately.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.