Performance: N+1 queries in renderTemplate() for category/author/tags #117

Closed
opened 2026-06-06 11:50:09 +00:00 by jmiller · 1 comment
Owner

Audit Finding

Severity: Medium

Issue:
Each call to renderTemplate() executes separate queries for category name, author name, and tags. With 10 services, that's 30 redundant queries since the article data hasn't changed.

Fix: Pre-load category, author, tags once before the service loop in dispatch() and pass to renderTemplate().

Files: CrossPostDispatcher.php

## Audit Finding **Severity:** Medium **Issue:** Each call to `renderTemplate()` executes separate queries for category name, author name, and tags. With 10 services, that's 30 redundant queries since the article data hasn't changed. **Fix:** Pre-load category, author, tags once before the service loop in `dispatch()` and pass to `renderTemplate()`. **Files:** `CrossPostDispatcher.php`
Author
Owner

Branch created: feature/117-performance-n-1-queries-in-rendertemplat

git fetch origin
git checkout feature/117-performance-n-1-queries-in-rendertemplat
Branch created: [`feature/117-performance-n-1-queries-in-rendertemplat`](https://git.mokoconsulting.tech/MokoConsulting/MokoJoomCross/src/branch/feature/117-performance-n-1-queries-in-rendertemplat) ```bash git fetch origin git checkout feature/117-performance-n-1-queries-in-rendertemplat ```
Sign in to join this conversation.