27 lines
1.4 KiB
SQL
27 lines
1.4 KiB
SQL
-- SIDEL ScriptsManager PostgreSQL Indexes and Performance Optimization
|
|
-- This script creates indexes and performance optimizations
|
|
|
|
-- Performance settings for the database
|
|
SET shared_preload_libraries = 'pg_stat_statements';
|
|
SET log_statement = 'ddl';
|
|
SET log_checkpoints = on;
|
|
SET log_connections = on;
|
|
SET log_disconnections = on;
|
|
|
|
-- Note: The following indexes will be created by SQLAlchemy when tables are created
|
|
-- This file serves as documentation and can be used for manual optimization
|
|
|
|
-- Indexes for common queries (will be created automatically by SQLAlchemy)
|
|
-- CREATE INDEX IF NOT EXISTS idx_users_username ON users(username);
|
|
-- CREATE INDEX IF NOT EXISTS idx_users_email ON users(email);
|
|
-- CREATE INDEX IF NOT EXISTS idx_scripts_user_id ON scripts(user_id);
|
|
-- CREATE INDEX IF NOT EXISTS idx_scripts_created_at ON scripts(created_at);
|
|
-- CREATE INDEX IF NOT EXISTS idx_execution_logs_script_id ON execution_logs(script_id);
|
|
-- CREATE INDEX IF NOT EXISTS idx_execution_logs_timestamp ON execution_logs(timestamp);
|
|
|
|
-- Full-text search indexes (if needed)
|
|
-- CREATE INDEX IF NOT EXISTS idx_scripts_name_search ON scripts USING gin(to_tsvector('english', name));
|
|
-- CREATE INDEX IF NOT EXISTS idx_scripts_description_search ON scripts USING gin(to_tsvector('english', description));
|
|
|
|
-- Comment for documentation
|
|
COMMENT ON SCHEMA public IS 'SIDEL ScriptsManager main schema with performance optimizations'; |