View Issue Details

IDProjectCategoryView StatusLast Update
0006277SOGoBackend Generalpublic2026-12-02 08:33
ReporterOlivierP Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionopen 
Platform[Server] LinuxOSDebianOS Version8 (Jessie)
Product Version5.12.13 
Summary0006277: Performance: missing indexes on sogo_quick_appointment cause full table scans on calendar views
Description

Summary

Calendar views (week/month) become very slow when the sogo_quick_appointment table grows beyond 0000082:0000050 000 rows. The root cause is that the official schema ships with no indexes on the date columns used by every calendar range query.

Environment

SOGo 5.12.13, single-store mode
MariaDB 10.x with Galera cluster
0000163:0000150 000 rows in sogo_quick_appointment
Observed response times: 10–20 s per calendar view request

Root cause

The official init script (Scripts/mysql-utf8mb4.sql) defines sogo_quick_appointment with only a composite primary key:

PRIMARY KEY (c_folder_id, c_name)

However, SOGoAppointmentFolder.m generates range queries filtered on c_startdate, c_enddate, and c_cycleenddate for every calendar view:

-- non-recurring events
WHERE c_iscycle = 0
AND (c_startdate IS NULL OR c_startdate <= ?)
AND (c_enddate IS NULL OR c_enddate >= ?)

-- recurring events
WHERE c_iscycle = 1
AND (c_cycleenddate IS NULL OR c_cycleenddate >= ?)

Without indexes on these columns, every view triggers a full table scan. EXPLAIN confirms:

type=ALL key=NULL rows=149840 Extra=Using where

A secondary issue: sogo_folder_info has no index on c_path2, causing an additional full scan (4 640 rows) on every user folder lookup.

Proposed fix:

Add the following indexes to the init script and to a migration script:

ALTER TABLE sogo_quick_appointment
ADD INDEX idx_cycle_start (c_iscycle, c_startdate),
ADD INDEX idx_cycle_end (c_iscycle, c_enddate),
ADD INDEX idx_cycleend (c_iscycle, c_cycleenddate);
ALTER TABLE sogo_folder_info
ADD INDEX idx_path2 (c_path2);

Thanks a lot
o.p.

TagsNo tags attached.

Activities

OlivierP

OlivierP

2026-12-02 08:33

reporter   ~0018620

Typo: approximatively 150 000 rows in sogo_quick_appointment
and not
sorry

Issue History

Date Modified Username Field Change
2026-12-02 08:31 OlivierP New Issue
2026-12-02 08:33 OlivierP Note Added: 0018620