Deployment Decision Guide
Pixeltable supports two production deployment patterns. Choose based on your constraints:| Question | Answer | Recommendation |
|---|---|---|
| Existing production DB that must stay? | Yes | Orchestration Layer |
| Building new multimodal app? | Yes | Full Backend |
| Need semantic search (RAG)? | Yes | Full Backend |
| Only ETL/transformation? | Yes | Orchestration Layer |
| Expose Pixeltable as MCP server for LLM tools? | Yes | Full Backend + MCP Server |
Technical Capabilities (Both)
Regardless of deployment mode, you get:- Multimodal Types: Native handling of Video, Document, Audio, Image, JSON.
- Computed Columns: Automatic incremental updates and dependency tracking.
- Views & Iterators: Built-in logic for chunking documents, extracting frames, etc.
- Model Orchestration: Rate-limited API calls to OpenAI, Anthropic, Gemini, local models.
- Data Interoperability: Import/export Parquet, PyTorch, LanceDB, pandas.
- Configurable Media Storage: Per-column destination (local or cloud bucket).
Deployment Strategies
Approach 1: Pixeltable as Orchestration Layer
Use Pixeltable for multimodal data orchestration while retaining your existing data infrastructure.Use When
Use When
- Existing RDBMS (PostgreSQL, MySQL) and blob storage (S3, GCS, Azure Blob) must remain
- Application already queries a separate data layer
- Incremental adoption required with minimal stack changes
Architecture
Architecture
- Deploy Pixeltable in Docker container or dedicated compute instance
- Define tables, views, computed columns, and UDFs for multimodal processing
- Process videos, documents, audio, images within Pixeltable
- Export structured outputs (embeddings, metadata, classifications) to RDBMS
- Export generated media to blob storage
- Application queries existing data layer, not Pixeltable
What This Provides
What This Provides
- Native multimodal type system (Video, Document, Audio, Image, JSON)
- Declarative computed columns eliminate orchestration boilerplate
- Incremental computation automatically handles new data
- UDFs encapsulate transformation logic
- LLM call orchestration with automatic rate limiting (see Advanced Features)
- Iterators for chunking documents, extracting frames, splitting audio
Approach 2: Pixeltable as Full Backend
Use Pixeltable for both orchestration and storage as your primary data backend.Use When
Use When
- Building new multimodal AI application
- Semantic search and vector similarity required
- Storage and ML pipeline need tight integration
- Stack consolidation preferred over separate storage/orchestration layers
Architecture
Architecture
- Deploy Pixeltable on persistent instance (EC2 with EBS, EKS with persistent volumes, VM)
- Build API endpoints (FastAPI, Flask, Django) that interact with Pixeltable tables
- Frontend calls endpoints to insert data and retrieve results
- Query using Pixeltable’s semantic search, filters, joins, and aggregations
- All data stored in Pixeltable: metadata, media references, computed column results
What This Provides
What This Provides
- Unified storage, computation, and retrieval in single system
- Native semantic search via embedding indexes (pgvector)
- No synchronization layer between storage and orchestration
- Automatic versioning and lineage tracking
- Incremental computation propagates through views
- LLM/agent orchestration (see Advanced Features)
- Data export to PyTorch, Parquet, LanceDB (see Data Interoperability)
Infrastructure Setup
Both deployment strategies require separating schema definition from application code.Code Organization
Schema Definition (setup_pixeltable.py):
- Defines directories, tables, views, computed columns, indexes
- Acts as Infrastructure-as-Code for Pixeltable entities
- Version controlled in Git
- Executed during initial deployment and schema migrations
app.py, endpoints.py, functions.py):
- Assumes Pixeltable infrastructure exists
- Interacts with tables via
pxt.get_table()and@pxt.udf - Handles missing tables/views gracefully
config.py):
- Externalizes model IDs, API keys, thresholds, connection strings
- Uses environment variables (
.env+python-dotenv) or secrets management - Never hardcodes secrets
Storage Architecture
Pixeltable is an OLTP database built on embedded PostgreSQL. It uses multiple storage mechanisms: How Media is Stored:- PostgreSQL stores only file paths/URLs, never raw media data.
- Inserted local files: path stored, original file remains in place.
- Inserted URLs: URL stored, file downloaded to File Cache on first access.
- Generated media (computed columns): saved to Media Store (default: local, configurable to S3/GCS/Azure per-column).
- File Cache size: configure via
file_cache_size_gin~/.pixeltable/config.toml. See configuration guide
- Pixeltable storage can be ephemeral (re-computable).
- Processing results exported to external RDBMS and blob storage.
- Reference input media from S3/GCS/Azure URIs.
- Pixeltable IS the RDBMS (embedded PostgreSQL, not replaceable).
- Requires persistent volume at
~/.pixeltable(pgdata, media, file_cache). - Media Store configurable to S3/GCS/Azure buckets for generated files.
Production Considerations
Concurrent Access & Scaling
| Aspect | Details |
|---|---|
| Locking | Automatic table-level locking for schema changes |
| Isolation | PostgreSQL SERIALIZABLE isolation prevents data race conditions |
| Retries | Built-in retry logic handles transient serialization failures |
| Multi-Process | Multiple workers/containers can safely read/write to the same instance |
| Scaling Dimension | Current Approach | Limitation |
|---|---|---|
| Metadata Storage | Single embedded PostgreSQL instance | Vertical scaling (larger EC2/VM) |
| Compute | Multiple API workers connected to same instance | Shared access to storage volume required |
| High Availability | Single attached storage volume | Failover requires volume detach/reattach |
Multi-node HA and horizontal scaling planned for Pixeltable Cloud (2026).
GPU Acceleration
- Automatic GPU Detection: Pixeltable uses CUDA GPUs for local models (Hugging Face, Ollama) when available.
- CPU Fallback: Models run on CPU if no GPU detected (functional but slower).
- Configuration: Control via
CUDA_VISIBLE_DEVICESenvironment variable.
Error Handling
| Error Type | Mode | Behavior |
|---|---|---|
| Computed Column Errors | on_error='abort' (default) | Fails entire operation if any row errors |
on_error='ignore' | Continues processing; stores None with error metadata | |
| Media Validation | media_validation='on_write' (default) | Validates media during insert (catches errors early) |
media_validation='on_read' | Defers validation until media accessed (faster inserts) |
table.column.errortype and table.column.errormsg.
Schema Evolution
| Operation Type | Examples | Impact |
|---|---|---|
| Safe | Add columns, Add computed columns, Add indexes | Incremental computation only |
| Destructive | Modify computed columns (if_exists='replace'), Drop columns/tables/views | Full recomputation or data loss |
- Version control
setup_pixeltable.pylike database migration scripts. - Rollback via
table.revert()(single operation) or Git revert (complex changes).
Code Organization
Separate schema definition from application logic to enable testability and safe migrations.- Project Structure
- config.py
- functions.py
- setup_pixeltable.py
- app.py
Key Principles:
- Module UDFs (
functions.py): Update when code changes; improve testability. Learn more - Retrieval Queries (
@pxt.query): Encapsulate complex retrieval logic as reusable functions. - Idempotency: Use
if_exists='ignore'to makesetup_pixeltable.pysafely re-runnable. Learn more
Monitoring and Performance
Logging:- Implement Python logging in UDFs and application endpoints
- Track execution time, errors, API call latency
- Use structured logging (JSON) for log aggregation
- Monitor CPU, RAM, Disk I/O, Network on Pixeltable host
- Track UDF execution time and model inference latency
- Alert on resource exhaustion
- Batch Operations: Use
@pxt.udf(batch_size=32)for GPU model inference - Batch Inserts: Insert multiple rows at once:
table.insert([row1, row2, ...]) - Profile UDFs: Add execution time logging to identify bottlenecks
- Embedding Indexes: pgvector for efficient similarity search. Learn more
- Built-In Providers: Automatic rate limiting for OpenAI, Anthropic, Gemini, etc. (configured per-model in
config.toml). - Custom APIs: Use
@pxt.udf(resource_pool='request-rate:my_service')to throttle calls to self-hosted models or custom endpoints (default: 600 RPM).
Deployment Patterns
Web Applications:- Execute
setup_pixeltable.pyduring deployment initialization - Web server processes connect to Pixeltable instance
- Pixeltable uses connection pooling internally
- Example: FastAPI with
pxt.get_table()in endpoint handlers
- Schedule via
cron, Airflow, AWS EventBridge, GCP Cloud Scheduler - Isolate batch workloads from real-time serving (separate containers/instances)
- Use Pixeltable’s incremental computation to process only new data
- Docker provides reproducible builds across environments
- Approach 2 (Full Backend): Mount persistent volume at
~/.pixeltable - Kubernetes: Use
ReadWriteOncePVC (single-pod write access) - Docker Compose or Kubernetes for multi-container deployments
Environment Management
Multi-Tenancy and Isolation
| Isolation Type | Implementation | Use Case | Overhead |
|---|---|---|---|
| Logical | Single Pixeltable instance with directory namespaces (pxt.create_dir(f"user_{user_id}")) | Dev/staging environments, simple multi-user apps | Low |
| Physical | Separate container instances per tenant | SaaS with strict data isolation | High |
High Availability Constraints
| Configuration | Status | Details |
|---|---|---|
| Single Pod + ReadWriteOnce PVC | ✅ Supported | One active pod writes to dedicated volume. Failover requires volume detach/reattach. |
| Multiple Pods + Shared Volume (NFS/EFS) | ❌ Not Supported | Will cause database corruption. Do not mount same pgdata to multiple pods. |
| Multi-Node HA | 🔜 Coming 2026 | Available in Pixeltable Cloud (serverless scaling, API endpoints). Join waitlist |
Environment Separation
Use environment-specific namespaces to manage dev/staging/prod configurations:Data Interoperability
Pixeltable integrates with existing data pipelines via import/export capabilities. Import:- CSV, Excel, JSON:
pxt.io.import_csv(),pxt.io.import_excel(),pxt.io.import_json() - Parquet:
pxt.io.import_parquet() - Pandas DataFrames:
table.insert(df)orpxt.create_table(source=df) - Hugging Face Datasets:
pxt.io.import_huggingface_dataset()
- Parquet:
pxt.io.export_parquet(table, path)for data warehousing - LanceDB:
pxt.io.export_lancedb(table, db_uri, table_name)for vector databases - PyTorch:
table.to_pytorch_dataset()for ML training pipelines - COCO:
table.to_coco_dataset()for computer vision - Pandas:
table.collect().to_pandas()for analysis
Dependency Management
Virtual Environments: Usevenv, conda, or uv to isolate dependencies.
Requirements:
- Pin versions:
package==X.Y.Z - Include integration packages (e.g.,
openai,sentence-transformers) - Test updates in staging before production
Advanced Features
LLM & Agent Workflows
Build complex agent workflows as computed columns with tool calling, MCP integration, and persistent state.
Data Sharing
Publish and replicate tables across Pixeltable instances for team collaboration.
Snapshots
Create immutable point-in-time copies for reproducible ML experiments.
Label Studio Integration
Sync tables with annotation projects for human-in-the-loop workflows.
Testing
Staging Environment:- Mirror production configuration.
- Test schema changes, UDF updates, application code changes.
- Use representative data (anonymized or synthetic).
Backup, Recovery, and Security
| Deployment Approach | Backup Strategy | Recovery Method |
|---|---|---|
| Orchestration Layer | External RDBMS + Blob Storage backups | Re-run transformation pipelines |
| Full Backend | pg_dump of ~/.pixeltable/pgdata + S3/GCS versioning | Restore pgdata + media files |
Security Best Practices
| Security Layer | Recommendation | Implementation |
|---|---|---|
| Network | Deploy within private VPC | Do not expose PostgreSQL port (5432) to internet |
| Authentication | Application layer (FastAPI/Django) | Pixeltable does not manage end-user accounts |
| Cloud Credentials | IAM Roles / Workload Identity | Avoid long-lived keys in config.toml |