Explore table schemas
The Table Schema Details tab shows the structure of tables used by your queries, including columns, data types, indexes, and constraints. Use this information to identify optimization opportunities and understand how queries interact with your data model.
What schema details reveal
Schema exploration helps you answer questions like:
- Which columns does this query access?
- Are there indexes that could speed up this query?
- What data types are used in the table?
- What constraints exist on the table?
- How is the table structured (CREATE statement)?
Access table schema details
To view schema details for a query:
- Navigate to Database Observability in Grafana Cloud.
- In the Queries Overview, click a query to open its details.
- Select the Table Schema Details tab.
Table picker
The top of the tab shows a Tables Involved in Query Execution heading that identifies the tables the query accesses. When a query touches multiple tables, a dropdown lets you select which table to inspect and a badge shows the total table count. When only one table is involved, it is selected automatically.
Schema detail sections
Below the table picker, three detail sections are stacked vertically for the selected table:
- Column details
- Index details
- Foreign key details
MySQL queries also display a Table Definition section with the full CREATE TABLE statement.
Schema information
Database Observability shows the same schema detail sections for both PostgreSQL and MySQL.
Column details
For each column, Database Observability shows:
Index details
For each index on the table. Primary key indexes appear first.
Foreign key details
For each foreign key constraint on the table:
MySQL: Table Definition
For MySQL tables, an additional Table Definition section displays the full CREATE TABLE statement in a SQL editor. This shows the complete schema structure to help evaluate query compatibility and optimization, including:
- Complete column definitions
- All indexes and keys
- Table options (
engine,charset,collation) - Partitioning configuration (if used)
Note
The Table Definition section is available for MySQL only. PostgreSQL does not display the
CREATE TABLEstatement.
Use schemas for optimization
Use the schema detail sections to spot indexing gaps and understand table relationships before making changes.
Spot missing index coverage
Columns in the Column details table display an Indexed badge when they are covered by at least one index. If a column used in a WHERE or ORDER BY clause has no badge, it may benefit from an index.
- Open the Table Schema Details tab.
- In the Column details table, look for filter or sort columns that lack the Indexed badge.
- Check the Index details table to confirm no existing index covers the column.
- If the column is unindexed, consider adding an index. For detailed guidance, refer to Improve slow queries.
Review existing indexes
The Index details table lists every index on the table with its type, covered columns or expressions, and whether it is unique or nullable. Primary key indexes appear first.
Use this information to:
- Confirm that composite indexes match your query’s filter and sort order.
- Check whether an index is unique when you expect uniqueness enforcement.
- Compare index coverage across tables involved in a join by switching tables in the dropdown.
Understand join relationships
The Foreign key details table shows how tables relate to each other. Use it to:
- Identify which columns participate in joins so you can verify they are indexed.
- Understand referential integrity constraints before modifying table structure.
- Trace data flow across tables when investigating unfamiliar queries.
For a complete optimization workflow including index creation examples, query rewrites, and verification steps, refer to Improve slow queries.
Configure schema collection
You can adjust collection intervals, caching behavior, database or schema exclusions, and disable the schema_details collector entirely. For all configuration options, refer to Tune Alloy collection.
Troubleshooting
Use these checks if schema details are missing or outdated.
Schema details not appearing
If the Table Schema Details tab is empty:
- Check permissions: Verify monitoring user has SELECT access
- Check collector: Ensure
schema_detailscollector is enabled - Check exclusions: Verify the database or schema isn’t in
exclude_databases(PostgreSQL) orexclude_schemas(MySQL) - Check logs: Look for schema collection errors in Alloy logs
Schema details outdated
If schema changes aren’t reflected:
- Cache expiration: Wait for cache TTL to expire (default 10 minutes)
- Force refresh: Restart Alloy to clear cache
- Reduce TTL: Configure shorter
cache_ttlfor frequently changing schemas
Tables don’t appear
If some tables don’t appear:
- Check query association: Tables appear only if queries use them
- Verify permissions: Check SELECT grant on specific tables
- Check schema scope: Ensure the table’s schema is monitored
Related documentation
- Analyze explain plans: Understand query execution
- Improve slow queries: Optimization workflow
- Tune Alloy collection: Configure collection settings
- PostgreSQL setup: Grant required permissions
- MySQL setup: Grant required permissions



