Docs reorg, config refactor, and ItemValues index fix
- Moved all documentation to docs/ and updated README with categorized links and new docs/INDEX.md - Added HOW_TO_SWITCH_DATABASE.md and several new analysis/action docs - Introduced db-config.ps1 for centralized DB config; all scripts now use it for easy DB switching - Added db-quick.ps1 for interactive diagnostics and index management - Updated Add-All-Indexes.bat to use db-config.ps1 - Added Fix-ItemValues-Performance.ps1 to create 3 critical indexes on ItemValues, addressing 1.3B row seq scan issue - Updated performance_indexes.sql with new ItemValues indexes and ANALYZE - Updated diagnostics.sql and database_report.txt for improved output and clarity - All scripts and docs now reference the new config and index optimization workflow
This commit is contained in:
+1
-1
@@ -355,7 +355,7 @@ BEGIN
|
||||
RAISE NOTICE 'RECOMMENDATION: Run VACUUM ANALYZE or adjust autovacuum settings';
|
||||
END IF;
|
||||
|
||||
RAISE NOTICE 'Diagnostic report complete.';
|
||||
-- RAISE NOTICE 'Diagnostic report complete.';
|
||||
END $$;
|
||||
|
||||
\echo ''
|
||||
|
||||
@@ -118,6 +118,28 @@ ON library."PeopleBaseItemMap" (ItemId, PeopleId);
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_itemvalues_map_value
|
||||
ON library."ItemValuesMap" (ItemValueId, ItemId);
|
||||
|
||||
-- ============================================================================
|
||||
-- ItemValues Table Indexes (Critical Performance Optimization)
|
||||
-- ============================================================================
|
||||
|
||||
\echo 'Creating indexes on ItemValues table...'
|
||||
|
||||
-- Index for CleanValue lookups (genre/tag searches by name)
|
||||
-- Fixes: 1.3 billion row sequential scans
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_itemvalues_cleanvalue
|
||||
ON library."ItemValues" ("CleanValue")
|
||||
WHERE "CleanValue" IS NOT NULL;
|
||||
|
||||
-- Index for Value lookups (direct value searches)
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_itemvalues_value
|
||||
ON library."ItemValues" ("Value")
|
||||
WHERE "Value" IS NOT NULL;
|
||||
|
||||
-- Index for ItemValueId + CleanValue (ItemValuesMap joins)
|
||||
-- Improves genre/tag filtering performance
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_itemvalues_id_cleanvalue
|
||||
ON library."ItemValues" ("ItemValueId", "CleanValue");
|
||||
|
||||
-- ============================================================================
|
||||
-- ActivityLog Table Indexes
|
||||
-- ============================================================================
|
||||
@@ -159,6 +181,7 @@ ANALYZE library."BaseItemProviders";
|
||||
ANALYZE library."UserData";
|
||||
ANALYZE library."PeopleBaseItemMap";
|
||||
ANALYZE library."ItemValuesMap";
|
||||
ANALYZE library."ItemValues";
|
||||
ANALYZE library."MediaStreamInfos";
|
||||
|
||||
-- Analyze ActivityLog if it exists
|
||||
|
||||
Reference in New Issue
Block a user