mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-08 14:53:53 -05:00
### Summary Performance optimization for the platform's store and creator functionality by adding targeted database indexes and implementing materialized views to reduce query execution time. ### Changes 🏗️ **Database Performance Optimizations:** - Added strategic database indexes for `StoreListing`, `StoreListingVersion`, `StoreListingReview`, `AgentGraphExecution`, and `Profile` tables - Implemented materialized views (`mv_agent_run_counts`, `mv_review_stats`) to cache expensive aggregation queries - Optimized `StoreAgent` and `Creator` views to use materialized views and improved query patterns - Added automated refresh function with 15-minute scheduling for materialized views (when pg_cron extension is available) **Key Performance Improvements:** - Filtered indexes on approved store listings to speed up marketplace queries - GIN index on categories for faster category-based searches - Composite indexes for common query patterns (e.g., listing + version lookups) - Pre-computed agent run counts and review statistics to eliminate expensive aggregations ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Verified migration runs successfully without errors - [x] Confirmed materialized views are created and populated correctly - [x] Tested StoreAgent and Creator view queries return expected results - [x] Validated automatic refresh function works properly - [x] Confirmed rollback migration successfully removes all changes #### For configuration changes: - [x] `.env.example` is updated or already compatible with my changes - [x] `docker-compose.yml` is updated or already compatible with my changes - [x] I have included a list of my configuration changes in the PR description (under **Changes**) **Note:** No configuration changes were required as this is purely a database schema optimization.
91 lines
1.8 KiB
YAML
91 lines
1.8 KiB
YAML
networks:
|
|
app-network:
|
|
name: app-network
|
|
shared-network:
|
|
name: shared-network
|
|
|
|
volumes:
|
|
supabase-config:
|
|
|
|
x-agpt-services:
|
|
&agpt-services
|
|
networks:
|
|
- app-network
|
|
- shared-network
|
|
|
|
x-supabase-services:
|
|
&supabase-services
|
|
networks:
|
|
- app-network
|
|
- shared-network
|
|
|
|
|
|
volumes:
|
|
clamav-data:
|
|
|
|
services:
|
|
|
|
db:
|
|
<<: *supabase-services
|
|
extends:
|
|
file: ../db/docker/docker-compose.yml
|
|
service: db
|
|
ports:
|
|
- ${POSTGRES_PORT}:5432 # We don't use Supavisor locally, so we expose the db directly.
|
|
|
|
vector:
|
|
<<: *supabase-services
|
|
extends:
|
|
file: ../db/docker/docker-compose.yml
|
|
service: vector
|
|
|
|
redis:
|
|
<<: *agpt-services
|
|
image: redis:latest
|
|
command: redis-server --requirepass password
|
|
ports:
|
|
- "6379:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
rabbitmq:
|
|
<<: *agpt-services
|
|
image: rabbitmq:management
|
|
container_name: rabbitmq
|
|
healthcheck:
|
|
test: rabbitmq-diagnostics -q ping
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
start_period: 10s
|
|
environment:
|
|
- RABBITMQ_DEFAULT_USER=rabbitmq_user_default
|
|
- RABBITMQ_DEFAULT_PASS=k0VMxyIJF9S35f3x2uaw5IWAl6Y536O7
|
|
ports:
|
|
- "5672:5672"
|
|
- "15672:15672"
|
|
clamav:
|
|
image: clamav/clamav-debian:latest
|
|
ports:
|
|
- "3310:3310"
|
|
volumes:
|
|
- clamav-data:/var/lib/clamav
|
|
environment:
|
|
- CLAMAV_NO_FRESHCLAMD=false
|
|
- CLAMD_CONF_StreamMaxLength=50M
|
|
- CLAMD_CONF_MaxFileSize=100M
|
|
- CLAMD_CONF_MaxScanSize=100M
|
|
- CLAMD_CONF_MaxThreads=12
|
|
- CLAMD_CONF_ReadTimeout=300
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "clamdscan --version || exit 1"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
networks:
|
|
app-network-test:
|
|
driver: bridge
|