---
title: Website Performance Optimization — Database Queries & Load Time
type: article
created: '2026-04-05'
updated: '2026-04-05'
source_docs:
- raw/2025-11-18-salesforce-call-102541065.md
tags:
- doodla-farms
- wordpress
- site-performance
- woocommerce
- database
- wp-engine
layer: 2
client_source: Doudlah Farms
industry_context: food-beverage
transferable: false
---

# Website Performance Optimization — Database Queries & Load Time

## Overview

During a routine review of the Doodla Farms WooCommerce site, a severe performance degradation was identified alongside a broken checkout flow. The root cause was traced to excessive database query load — approximately 10× the normal volume — overwhelming the server and producing 502 Bad Gateway errors. The checkout has been restored to working order, but the site remains slow and requires further optimization.

See also: [[wiki/clients/current/doudlah-farms/_index]] | [[wiki/clients/current/doudlah-farms/2026-04-05-email-migration-outlook-to-gmail]]

---

## Symptoms

- **502 Bad Gateway errors** — server being overwhelmed under load
- **Blank checkout page** — blocking all customer purchases
- **14-second page load time** — well above acceptable thresholds
- **Bot traffic** — dozens of failed order attempts from automated bots, which triggered the initial investigation
- **Server bandwidth** — site was approaching hosting plan limits on WP Engine

---

## Root Cause Analysis

### Excessive Database Queries

A normal WordPress/WooCommerce site runs approximately **100 database queries** per page load. At the time of discovery, Doodla Farms was generating **~1,000 queries** — a 10× excess. This was traced to poorly written plugins making unnecessary, high-frequency database calls (e.g., a coupon plugin polling for new coupons every second).

### Bloated Memory Usage

Page memory had grown to **over 200MB**, largely due to a WordPress activity log plugin that was recording every admin action into an ever-growing database table. This table alone had accumulated ~100MB of data.

### Homepage Hero Video

A large video asset embedded in the homepage hero section was contributing to load time. Even after being disabled from displaying, the video file remained part of the page payload.

---

## Fixes Implemented

| Fix | Result |
|---|---|
| Cleared WordPress activity log table (~100MB) | Memory reduced from >200MB to 64MB |
| Disabled homepage hero video | Partial load time improvement |
| Removed/disabled problematic plugins | Query count reduced from ~1,000 to 533 |
| Cleared caching layers (after caching tools broke checkout) | Checkout restored to functional |
| Coordinated with WP Engine via server log review | Confirmed query overload as primary cause |

---

## Current Status (as of meeting date)

| Metric | Before | After | Target |
|---|---|---|---|
| DB queries | ~1,000 | 533 | ~100 |
| Memory usage | >200MB | 64MB | ✅ Good |
| Page load time | Unknown baseline | **14 seconds** | <3s |
| Checkout | Broken (blank page) | **Functional** | ✅ |
| PHP errors | Unknown | 2 | 0 |

The checkout is working and orders are flowing. However, **533 queries and a 14-second load time remain unacceptable** and require a dedicated optimization pass.

---

## Known Remaining Issues

- **Query count still high** at 533 (target: ~100). Additional plugin audit needed to identify remaining offenders.
- **Homepage hero video** file still present in the site — should be deleted from media library if the video is not being reinstated.
- **2 PHP errors** present in admin bar diagnostics — source not yet identified.
- **Caching tools** were attempted but broke the checkout and had to be rolled back. A more careful, staged approach is needed.

---

## Lessons Learned

> Plugin selection on WooCommerce sites requires careful vetting. A single poorly written plugin can generate hundreds of unnecessary DB queries per page load, degrading performance site-wide. Plugins should be evaluated for query impact before installation, not after symptoms appear.

---

## Next Steps

- [ ] Schedule dedicated site optimization session (Mark + Karly) within the next few weeks
- [ ] Audit remaining active plugins for query footprint
- [ ] Delete homepage hero video from media library (confirm with Lucy first)
- [ ] Investigate and resolve 2 PHP errors
- [ ] Re-attempt caching implementation in a staged, tested manner
- [ ] Establish a query/memory baseline monitoring approach going forward

---

## Related

- [[wiki/clients/current/doudlah-farms/2026-04-05-email-migration-outlook-to-gmail]]
- [[wiki/clients/current/doudlah-farms/2026-04-05-domain-transfer-godaddy]]
- [[wiki/clients/current/doudlah-farms/2026-04-05-packaging-redesign-and-grant-funding]]
- [[wiki/meetings/2026-04-05-salesforce-call-company-status-doodla-farms-quarra-italia]]