mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-29 05:47:06 -05:00
Compare commits
2 Commits
fa8ba8969a
...
76742482e4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76742482e4 | ||
|
|
6c3d7f1a5c |
@@ -0,0 +1,17 @@
|
||||
-- Phase 8: Remove Duplicate Indexes
|
||||
-- All duplicate indexes verified as identical via pg_indexes
|
||||
|
||||
-- 1. content_submissions: Keep newer lock management index (idx_content_submissions_locks)
|
||||
DROP INDEX IF EXISTS public.idx_submissions_assigned;
|
||||
|
||||
-- 2. parks: Keep original park_type index (idx_parks_park_type)
|
||||
DROP INDEX IF EXISTS public.idx_parks_type;
|
||||
|
||||
-- 3. photo_submissions: Keep more descriptive name (idx_photo_submissions_submission_id)
|
||||
DROP INDEX IF EXISTS public.idx_photo_submissions_submission;
|
||||
|
||||
-- 4. ride_model_technical_specifications: Keep full name (idx_ride_model_technical_specs_search)
|
||||
DROP INDEX IF EXISTS public.idx_ride_model_tech_specs_search;
|
||||
|
||||
-- 5. ride_technical_specifications: Keep full name (idx_ride_technical_specs_search)
|
||||
DROP INDEX IF EXISTS public.idx_ride_tech_specs_search;
|
||||
@@ -0,0 +1,55 @@
|
||||
-- Phase 9A: Add Critical Foreign Key Indexes for Query Performance
|
||||
-- These indexes cover the most frequently accessed foreign key relationships
|
||||
|
||||
-- Core entity relationships (highest priority)
|
||||
-- These are queried on EVERY page load for parks/rides to fetch current version data
|
||||
|
||||
-- Park version foreign keys
|
||||
CREATE INDEX IF NOT EXISTS idx_park_versions_park_id
|
||||
ON park_versions(park_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_park_versions_location_id
|
||||
ON park_versions(location_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_park_versions_operator_id
|
||||
ON park_versions(operator_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_park_versions_property_owner_id
|
||||
ON park_versions(property_owner_id);
|
||||
|
||||
-- Ride version foreign keys
|
||||
CREATE INDEX IF NOT EXISTS idx_ride_versions_ride_id
|
||||
ON ride_versions(ride_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_ride_versions_park_id
|
||||
ON ride_versions(park_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_ride_versions_manufacturer_id
|
||||
ON ride_versions(manufacturer_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_ride_versions_designer_id
|
||||
ON ride_versions(designer_id);
|
||||
|
||||
-- User engagement foreign keys
|
||||
CREATE INDEX IF NOT EXISTS idx_user_ride_credits_ride_id
|
||||
ON user_ride_credits(ride_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_reviews_moderated_by
|
||||
ON reviews(moderated_by);
|
||||
|
||||
-- Moderation queue foreign keys
|
||||
CREATE INDEX IF NOT EXISTS idx_content_submissions_reviewer_id
|
||||
ON content_submissions(reviewer_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_content_submissions_original_submission_id
|
||||
ON content_submissions(original_submission_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_reports_reviewed_by
|
||||
ON reports(reviewed_by);
|
||||
|
||||
-- Profile lookup foreign keys
|
||||
CREATE INDEX IF NOT EXISTS idx_profiles_location_id
|
||||
ON profiles(location_id);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_profiles_home_park_id
|
||||
ON profiles(home_park_id);
|
||||
Reference in New Issue
Block a user