Preferred Tables
Preferred tables allow each user to personally mark specific tables that the AI should prioritize when generating SQL queries. Marked tables are sent to the LLM with full metadata — including columns, data types, and business descriptions — so the AI understands exactly what data is available and uses it first.
Overview
When you ask a natural language question, Actyze's AI needs to decide which tables to use. Preferred tables help by:
- Pinpointing the exact tables most relevant to your work
- Sending full column context to the LLM so it builds better SQL
- Reducing ambiguity when multiple similar tables exist
- Personalizing results to your role and data patterns
This is a user-level setting — each user has their own preferred tables list, up to 25 tables by default (configurable by administrators).
How It Works
Without Preferred Tables
Query: "Show me customer revenue"
AI uses semantic search over all accessible tables:
- sales.public.customers (score: 0.75)
- analytics.mart.customer_revenue (score: 0.73)
- staging.temp.customer_data (score: 0.71)
Selected: sales.public.customers (highest score)
→ May not be the table you actually want
With Preferred Tables
Query: "Show me customer revenue"
User has marked as preferred: analytics.mart.customer_revenue
AI receives:
★ analytics.mart.customer_revenue (PREFERRED)
Columns: customer_id (bigint), customer_name (varchar),
total_revenue (decimal), region (varchar), ...
AI selects: analytics.mart.customer_revenue ✓
→ Uses your preferred table with full column knowledge
Setting Preferred Tables
Via User Interface
Step 1: Open Schema Optimize
- Go to Data Intelligence → Schema Optimize
- Browse the database tree on the left
Step 2: Mark a Table as Preferred
- Click any table name in the tree
- In the right panel, toggle "Mark as Preferred"
- Click Save
A ⭐ star icon appears next to preferred tables in both Schema Optimize and the Query page schema sidebar, giving you instant visual confirmation.
Step 3: Bulk Preferred Mode
To mark many tables at once:
- Click "Bulk Preferred" button at the top of Schema Optimize
- Checkboxes appear on all table rows
- Select tables individually, or use "Select all tables" under a schema
- Click "Mark Preferred" or "Remove Preferred" in the action bar at the bottom
Via API
Add a Preferred Table:
curl -X POST https://your-actyze.com/api/preferences/preferred-tables \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"catalog": "postgres",
"schema_name": "analytics",
"table_name": "customer_revenue"
}'
Add Multiple Tables (Bulk):
curl -X POST https://your-actyze.com/api/preferences/preferred-tables/bulk \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"tables": [
{"catalog": "postgres", "schema_name": "analytics", "table_name": "customer_revenue"},
{"catalog": "postgres", "schema_name": "analytics", "table_name": "monthly_summary"}
]
}'
View Your Preferred Tables:
curl -X GET https://your-actyze.com/api/preferences/preferred-tables \
-H "Authorization: Bearer YOUR_TOKEN"
Response:
[
{
"id": "pref-uuid-1",
"catalog": "postgres",
"database_name": "postgres",
"schema_name": "analytics",
"table_name": "customer_revenue",
"full_name": "postgres.analytics.customer_revenue",
"table_metadata": "Primary revenue reporting table for the analytics team",
"created_at": "2026-01-15T10:30:00Z",
"updated_at": "2026-01-15T10:30:00Z"
}
]
Remove a Preferred Table:
curl -X DELETE https://your-actyze.com/api/preferences/preferred-tables/{preference_id} \
-H "Authorization: Bearer YOUR_TOKEN"
Remove Multiple Tables (Bulk):
curl -X DELETE https://your-actyze.com/api/preferences/preferred-tables/bulk \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"preference_ids": ["pref-uuid-1", "pref-uuid-2"]
}'
The 25-Table Limit
By default, each user can mark up to 25 tables as preferred. This limit exists because each preferred table adds its full column list and metadata to the LLM prompt, consuming tokens.
Administrators can adjust this limit via the MAX_PREFERRED_TABLES environment variable in docker-compose.yml (Docker) or nexus.env.maxPreferredTables in values.yaml (Kubernetes/Helm).
Token budget guidance: If raising the limit, also increase EXTERNAL_LLM_MAX_TOKENS:
| Preferred Tables Limit | Recommended Max Tokens |
|---|---|
| 10–25 (default) | 4096 (default) |
| 26–40 | 6000 |
| 41–50 | 8000 |
What Gets Sent to the AI
For each preferred table, the AI receives:
★ postgres.analytics.customer_revenue (PREFERRED)
Description: Primary revenue reporting table for the analytics team
Columns:
- customer_id (bigint)
- customer_name (varchar) — Full legal name of the customer
- total_revenue (decimal) — Lifetime revenue in USD
- region (varchar) — Geographic region code
- last_purchase_date (date)
- segment (varchar) — Customer tier: enterprise, smb, consumer
The metadata descriptions (table and column descriptions) come from your organization's Metadata Descriptions settings and significantly improve AI accuracy.
Use Cases
Scenario 1: Team-Specific Tables
Problem: Your analytics team has its own reporting tables, but the AI sometimes picks staging or raw tables instead.
Solution: Mark your team's canonical reporting tables as preferred.
Result:
Query: "Show monthly revenue by region"
Uses: postgres.analytics.monthly_revenue_by_region ★
Over: postgres.staging.raw_transactions
Scenario 2: Production vs Staging
Problem: You always want production data, not staging.
Solution: Mark all production tables as preferred.
Result:
Query: "Show all customers"
Uses: postgres.production.customers ★
Unless you explicitly say "show me staging customers"
Scenario 3: Complex Domain Tables
Problem: A table has 80 columns but only 10 are relevant to your work. The AI doesn't always choose the right columns.
Solution: Mark the table as preferred. The AI receives all column names and types upfront, plus any descriptions you've added via Metadata, so it can make much better column selections.
Rules & Constraints
- Table-level only: Preferred functionality applies to individual tables, not entire schemas or databases
- User-specific: Your preferred tables are private — other users have their own lists
- Cannot mark hidden tables: Tables hidden by an admin (excluded from the schema) cannot be marked as preferred
- Hiding removes preference: If a previously-preferred table is hidden by an admin, the preference is automatically removed
- Limit enforced server-side: The
MAX_PREFERRED_TABLESlimit is enforced by the backend even for bulk operations
Visual Indicators
- ⭐ in Query page sidebar: Preferred tables show a gold star next to their name in the schema tree on the Query page
- ★ in Schema Optimize: Preferred tables are starred in the Schema Optimize tree
- Counter in Schema Optimize: Shows
(X/25 tables marked)with color coding: green (plenty of room), yellow (>80% full), red (at limit)