Backends Overview
FilterMate uses a multi-backend architecture to provide optimal performance across different data sources. The backend is automatically selected based on your layer type—no configuration needed.
What Are Backends?
Backends are the engines that process your filtering operations. FilterMate includes three specialized backends optimized for different data sources:
- PostgreSQL Backend: Server-side processing for maximum speed
- Spatialite Backend: Local database with spatial indexes
- OGR Backend: Universal compatibility for file formats
Most users don't need to worry about backends! FilterMate automatically chooses the best one for your data. Just load your layer and filter.
Architecture
modules/backends/
├── base_backend.py # Abstract interface
├── postgresql_backend.py # PostgreSQL/PostGIS backend
├── spatialite_backend.py # Spatialite backend
├── ogr_backend.py # Universal OGR backend
└── factory.py # Automatic backend selection
Automatic Selection Logic
FilterMate intelligently selects the best backend based on your layer:
How It Works:
- Checks for manual backend selection (v2.3.5+) - User can force specific backend
- Detects layer provider type (PostgreSQL, Spatialite, or OGR)
- Checks PostgreSQL availability (is psycopg2 installed?)
- Selects optimal backend with performance warnings when needed
- Falls back gracefully if the best option is unavailable
You can force a specific backend by clicking the backend indicator icon next to each layer name. This is useful for:
- Testing different backends
- Using Spatialite on small PostgreSQL layers
- Forcing OGR when you want file-based operations
Backend Comparison
| Feature | PostgreSQL | Spatialite | OGR |
|---|---|---|---|
Speed (<10k features) | <1s ⚡ | <1s ⚡ | ~2s |
| Speed (100k features) | ~2s ⚡ | ~8s | ~15s 🐌 |
| Speed (1M features) | ~10s ⚡ | ~60s 🐌 | Timeout ❌ |
| Concurrent Operations | Excellent | Good | Limited |
| Installation | Optional (psycopg2) | Built-in ✓ | Built-in ✓ |
| Data Source | PostgreSQL/PostGIS | .sqlite files | Shapefiles, GPKG, etc. |
| Best For | Large datasets (>50k) | Medium datasets (<50k) | All formats |
Backend Features
PostgreSQL Backend
Technology: Server-side processing with materialized views
Capabilities:
- ✅ Materialized views for ultra-fast filtering
- ✅ Native spatial indexes (GIST)
- ✅ Server-side spatial operations
- ✅ Concurrent operations support
Automatically Used When:
- Layer source is PostgreSQL/PostGIS
- psycopg2 is installed
- Recommended for
>50kfeatures
Performance: Best-in-class for large datasets
Spatialite Backend
Technology: Temporary tables with R-tree indexes
Capabilities: