Fix catastrophic targets query and remove emoji from night mode buttons

The seasonal peak subquery used a correlated SELECT inside a GROUP BY,
causing a full nightly_cache scan per object (210-270s for 14k objects).
Replaced with a simple MAX() GROUP BY — now instant.

Also added three indexes on nightly_cache(night_date) that were missing
and causing all dashboard queries to run 2+ second full table scans.

Replaced 🔴 emoji in night mode buttons with CSS circles.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-17 11:02:24 +02:00
parent 4fbc578413
commit a562dae1e3
3 changed files with 31 additions and 12 deletions
+12 -3
View File
@@ -49,7 +49,6 @@ export function BottomNav() {
background: on ? 'rgba(160,0,0,0.85)' : 'var(--bg-panel)',
border: `1px solid ${on ? '#800000' : 'var(--border)'}`,
color: on ? '#ff6666' : 'var(--text-lo)',
fontSize: 16,
display: 'none', // shown by .bottom-nav display:flex breakpoint via CSS class
alignItems: 'center',
justifyContent: 'center',
@@ -59,7 +58,12 @@ export function BottomNav() {
}}
className="night-fab"
>
🔴
<span style={{
display: 'inline-block', width: 10, height: 10, borderRadius: '50%',
background: on ? '#ff4444' : 'var(--text-lo)',
boxShadow: on ? '0 0 6px #ff4444' : 'none',
transition: 'all 0.3s',
}} />
</button>
<nav className="bottom-nav">
{navItems.map(item => (
@@ -192,7 +196,12 @@ export default function Sidebar() {
letterSpacing: '0.06em', transition: 'all 0.2s',
}}
>
<span style={{ fontSize: 13 }}>🔴</span>
<span style={{
display: 'inline-block', width: 8, height: 8, borderRadius: '50%',
background: nightOn ? '#ff4444' : 'var(--text-lo)',
boxShadow: nightOn ? '0 0 5px #ff4444' : 'none',
flexShrink: 0, transition: 'all 0.2s',
}} />
{nightOn ? 'Exit Night Mode' : 'Night Mode'}
</button>
</div>