Skip to main content

SYS.ORGANIZATION.MODEL_USAGE

The sys.organization.model_usage table contains metadata for AI model usage through Dremio Cloud's managed AI service. This table tracks usage of AI features such as Text-to-SQL, label generation, and wiki generation.

Syntax
SELECT * FROM sys.organization.model_usage

Example Output

iduser_idproject_idmodel_provider_namemodel_nameinput_tokensoutput_tokensduration_msinteraction_idcreated_atnum_model_callsinteraction_type
000286ac-3162-4dcd-8d28-59dfa71aeae5408670d3-7d91-42ab-bd1e-908a5cd676e40c6e634e-0546-4da8-8e81-6b7b9f15530cOpenAIgpt-4o1250851850cceec24c-a201-494d-87f6-34081cea87592025-08-01 04:48:55.0611TEXT_TO_SQL
000286ac-3162-4dcd-8d28-59dfa71aeae6408670d3-7d91-42ab-bd1e-908a5cd676e40c6e634e-0546-4da8-8e81-6b7b9f15530cAWS Bedrockclaude-3-sonnet9801202100ddeec24c-a201-494d-87f6-34081cea87602025-08-01 05:15:22.1451LABEL_GENERATION
000286ac-3162-4dcd-8d28-59dfa71aeae7408670d3-7d91-42ab-bd1e-908a5cd676e40c6e634e-0546-4da8-8e81-6b7b9f15530cAzure OpenAIgpt-4o1100951750eeeec24c-a201-494d-87f6-34081cea87612025-08-01 06:22:18.8921WIKI_GENERATION

Columns

ColumnData TypeDescription
idvarcharThe UUID of the usage record.
user_idvarcharThe ID of the user who made the request.
project_idvarcharThe ID of the project where the request was made.
model_provider_namevarcharThe name of the AI model provider. Dremio Cloud supports multiple managed providers: "OpenAI", "AWS Bedrock", and "Azure OpenAI".
model_namevarcharThe name of the AI model used during the interaction (e.g., "gpt-4o").
input_tokensfloatThe number of input tokens consumed, excluding cached tokens.
cached_read_input_tokensfloatThe number of cached read input tokens consumed.
cached_write_input_tokensfloatThe number of cached write input tokens consumed.
output_tokensfloatThe number of output tokens consumed.
duration_msfloatThe request execution time in milliseconds.
interaction_idvarcharThe ID of the interaction, such as a Text-to-SQL session ID or label generation job ID.
created_attimestampThe date and time when the usage record was created.
num_model_callsfloatThe number of model calls made in the usage record.
interaction_typevarcharThe type of AI interaction. Values include: TEXT_TO_SQL, LABEL_GENERATION, WIKI_GENERATION, SEMANTIC_SEARCH.

Usage Examples

View AI usage by interaction type

SELECT 
interaction_type,
COUNT(*) as total_interactions,
SUM(input_tokens) as total_input_tokens,
SUM(output_tokens) as total_output_tokens
FROM sys.organization.model_usage
WHERE created_at >= CURRENT_DATE - INTERVAL '30' DAY
GROUP BY interaction_type
ORDER BY total_interactions DESC;

View AI usage by project

SELECT 
p.project_name,
COUNT(m.id) as total_interactions,
SUM(m.input_tokens + m.output_tokens) as total_tokens
FROM sys.organization.model_usage m
JOIN sys.organization.projects p ON m.project_id = p.project_id
WHERE m.created_at >= CURRENT_DATE - INTERVAL '7' DAY
GROUP BY p.project_name
ORDER BY total_tokens DESC;
SELECT 
DATE_TRUNC('day', created_at) as usage_date,
interaction_type,
COUNT(*) as interactions,
SUM(input_tokens + output_tokens) as total_tokens
FROM sys.organization.model_usage
WHERE created_at >= CURRENT_DATE - INTERVAL '30' DAY
GROUP BY DATE_TRUNC('day', created_at), interaction_type
ORDER BY usage_date DESC, total_tokens DESC;

Notes

  • Managed AI Service: Dremio Cloud uses managed AI services with support for multiple providers: OpenAI, AWS Bedrock, and Azure OpenAI
  • Data Retention: Usage data is retained for 365 days
  • Delay: There may be a 1-2 hour delay between AI feature usage and when the data appears in this table
  • Privacy: Only metadata about AI usage is stored; actual prompts and responses are not persisted
  • Permissions: Users can only see usage data for projects they have access to