API Maker's Deep Populate feature enables advanced nested queries and unified data access across PostgreSQL and other databases, all through a single API call. This eliminates the need for complex JOIN operations and manual relationship handling while providing seamless integration across multiple database systems.
Deep Populate transforms data retrieval by fetching nested information across tables and databases in a single request. PostgreSQL's robust feature set makes it particularly well-suited for these operations, offering:
API Maker uses standardized JSON syntax for defining Deep Populate relationships:
{
"s_key": "foreign_key_field",
"t_col": "target_collection",
"t_key": "primary_key_field",
"select": "field1,field2,field3",
"isMultiple": false
}
Quickly fetch related data from connected tables in one API call:
Request:
POST /api/gen/postgresql/app/users
Content-Type: application/json
{
"find": {"user_id": 2045},
"deep": [{
"s_key": "user_id",
"t_col": "user_preferences",
"t_key": "user_id",
"select": "theme,notification_settings,privacy_level"
}]
}
Response:
{
"user_id": 2045,
"username": "sarah_dev",
"email": "sarah@company.com",
"created_at": "2024-01-15T10:30:00Z",
"user_preferences": {
"theme": "dark",
"notification_settings": {"email": true, "push": false},
"privacy_level": "standard"
}
}
Handle complex hierarchical relationships by chaining multiple levels of nested queries. This is ideal for retrieving deeply related data across parent-child-grandchild structures.
Request:
{
"find": {"transaction_id": 12345},
"deep": [{
"s_key": "account_id",
"t_col": "accounts",
"t_key": "account_id",
"select": "account_number,balance,account_type",
"deep": [{
"s_key": "customer_id",
"t_col": "customers",
"t_key": "customer_id",
"select": "full_name,customer_since,status"
}]
}]
}
Response:
{
"transaction_id": 12345,
"amount": 2500.00,
"transaction_date": "2024-08-07T14:30:00Z",
"accounts": {
"account_id": "ACC-789012",
"account_number": "****3456",
"balance": 15750.25,
"account_type": "checking",
"customers": {
"customer_id": 5678,
"full_name": "Michael Johnson",
"customer_since": "2019-03-15",
"status": "active"
}
}
}
Break the boundaries of single-database querying. Deep Populate enables unified access to data spread across PostgreSQL, MongoDB, and other systems—without writing multiple queries or joining APIs manually.
Request:
{
"find": {"customer_id": 5678},
"deep": [{
"s_key": "customer_id",
"t_instance": "mongodb_analytics",
"t_db": "customer_analytics",
"t_col": "behavioral_data",
"t_key": "customer_id",
"select": "purchase_patterns,engagement_score,segment"
}]
}
Response:
{
"customer_id": 5678,
"full_name": "Emma Rodriguez",
"email": "emma.r@company.com",
"account_status": "premium",
"behavioral_data": {
"purchase_patterns": {
"preferred_categories": ["electronics", "books"],
"average_order_value": 156.75
},
"engagement_score": 8.7,
"segment": "high-value"
}
}
JSONB Integration: PostgreSQL's JSONB data type works seamlessly with Deep Populate, enabling efficient storage and querying of semi-structured data within relational structures.
Composite Types: Create custom data types representing complex business objects that Deep Populate can navigate effectively.
Advanced Indexing: Utilize composite and partial indexes on foreign key relationships to optimize Deep Populate query performance.
Tip: Use PostgreSQL’s
EXPLAIN ANALYZE
to identify performance bottlenecks in nested queries.
Deep Populate works across all generated API methods:
API Maker's Deep Populate supports multiple database integrations:
This multi-database support enables PostgreSQL to serve as your transactional anchor while accessing related data from specialized systems through unified API interfaces.
Yes, you can use the /api/gen/...
endpoint for ad-hoc Deep Populate queries without schemas. However, defining schemas in API Maker enhances performance, enables query validation, and simplifies relationship management.
If a target database is offline, API Maker returns the primary PostgreSQL data with null
or empty nested fields. Missing records result in empty arrays or null
values, with errors in the response’s errors
field.
There’s no strict limit on nesting levels. For optimal performance, 3–4 levels are recommended, especially for complex cross-database queries. Use indexing and limit
to manage performance.
Yes, Deep Populate leverages PostgreSQL’s indexing (e.g., B-tree, GIN) for faster joins. Ensure s_key
and t_key
fields are indexed to optimize query performance.
Unlike native JOINs, limited to a single PostgreSQL instance, Deep Populate enables joins across different databases (e.g., MongoDB, MySQL) with simpler JSON-based syntax, reducing client-side complexity.
Use the API Maker Test Console, Postman, cURL, or JavaScript (fetch/axios) to test queries. Start with single-level queries before expanding to multi-level or cross-database operations.
The table below compares API Maker (Deep Populate), Supabase, Appwrite, Firebase, and GraphQL across key features for building modern applications with cross-database capabilities.
Aspect / Feature | API Maker (Deep Populate) | Supabase | Appwrite | Firebase | GraphQL |
---|---|---|---|---|---|
Database Type | Advanced PostgreSQL + multi-DB (MongoDB, Redis) | PostgreSQL | Document DB | NoSQL (Realtime DB, Firestore) | Query language over any backend |
Nested Queries | Deep, cross-DB nested SQL in one call | Nested queries, real-time support | Document queries, less SQL focus | Limited joins, sync focus | Precise nested queries, client-driven |
Cross-DB Support | Native across different DBs | Limited, mainly PostgreSQL | Not supported | Not supported | Possible with manual federation |
API Generation | Auto-generated REST, customizable & deeply nested | Auto REST/GraphQL APIs, edge functions | REST APIs, serverless functions | SDKs, manual API creation | Schema-driven, manual resolvers |
Real-Time | Event triggers for sync & automation | WebSocket-based real-time | Real-time subs, cloud functions | Realtime sync, messaging | Subscriptions, needs backend setup |
Security | PostgreSQL RLS + API Maker RBAC | RLS, auth, MFA | Built-in auth, granular permissions | Firebase Auth, social, MFA | Depends on backend/schemas |
Developer Experience | Low-code, Git deploy, tests, caching, monitoring | CLI, dashboard, client libs | Open-source SDKs, CLI, multi-platform | SDKs, managed, easy integration | Highly flexible, more backend setup |
Performance/Scalability | PostgreSQL indexing, pooling, replicas | Managed Postgres, replicas, CDN | Scalable open-source | Google Cloud scale | Depends on backend setup |
💡 Want to see Deep Populate in action? Try it live on the API Maker Playground or explore the Getting Started Guide.