Applies to:
- Plan:
- Deployment:
Summary
Issue: SQL queries usingproject_logs() time out when scanning large datasets without timestamp constraints, even with other filters applied.
Cause: Without timestamp filters, queries can scan the entire project history regardless of other WHERE conditions.
Resolution: Add a range filter on created, _xact_id, _pagination_key, or scope the query to a specific root_span_id or id to limit the scan range.
The SQL sandbox proactively warns you about missing range filters before you run the query — a warning indicator appears next to the Run button so you don’t need to wait for a timeout to discover the issue.
Resolution Steps
Add a range filter to your query
Step 1: Add a range filter constraint
Add acreated, _xact_id, or _pagination_key filter to your WHERE clause, or scope the query to a specific root_span_id or id.
Step 2: Adjust time range as needed
Modify the interval based on your investigation needs:'1 day', '30 days', etc.
Best practices for project_logs queries
Always include range filters
This is a required best practice for acceptable query performance, not an optional optimization. Accepted range filters include:created— filter by timestamp (most common)_xact_id— filter by transaction ID range_pagination_key— filter by pagination key range- Scope to a specific
root_span_idorid
Start with narrow time ranges
Begin with shorter intervals (e.g.,'1 day') and expand only if necessary.