mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
perf: replace fat-view student index query with lean getPublishedAuthors()
The répertoire page was loading the full v_theses_public view (15 JOINs + 8 GROUP_CONCAT temp B-trees) via getAllPublishedTheses() just to build the student name → thesis-id map on the index page. Only two columns (id, authors) were ever consumed by the template. Add Database::getPublishedAuthors(): array - Queries thesis_authors JOIN authors directly on the theses base table - Filters on theses.is_published = 1 using the existing index - Returns only id + GROUP_CONCAT(authors) — no view expansion - Results verified identical to the old getAllPublishedTheses() output Update search.php to call getPublishedAuthors() instead. Mark getAllPublishedTheses() @deprecated in Database.php. All tests pass.
This commit is contained in:
9
TODO.md
9
TODO.md
@@ -363,12 +363,11 @@ Goal: rename the tables and column to the canonical M2M pattern (`tags`, `thesis
|
||||
with a plain table query in `searchTheses` and `getPublishedTheses`** — build the minimal JOIN set
|
||||
per query and let indexes filter `theses` first. Keep the views for reporting/admin use only.
|
||||
|
||||
- [ ] **`getAllPublishedTheses()` in `search.php`** — fetches every published thesis (all columns,
|
||||
- [x] **`getAllPublishedTheses()` in `search.php`** — fetches every published thesis (all columns,
|
||||
all JOINs) just to build the student-name index on the Répertoire page. This is a full table
|
||||
scan through the fat view. Replace with a dedicated lean query:
|
||||
`SELECT id, authors FROM v_theses_public ORDER BY authors ASC` — or add
|
||||
`Database::getPublishedAuthors(): array` that queries `thesis_authors JOIN authors` directly,
|
||||
avoiding the view entirely.
|
||||
scan through the fat view. Replaced with `Database::getPublishedAuthors(): array` that queries
|
||||
`thesis_authors JOIN authors` directly (only `id` + `authors` columns), avoiding the view entirely.
|
||||
`getAllPublishedTheses()` kept but marked `@deprecated`.
|
||||
|
||||
- [x] **`migration 005` view is stale in the file** — `005_add_banner.sql` recreates the view still
|
||||
referencing `thesis_keywords` / `keywords.keyword` (the old pre-migration-001 names).
|
||||
|
||||
Reference in New Issue
Block a user