Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions apps/docs/analytics/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ description: "Common issues and solutions for analytics queries"

```sql
-- Instead of raw table for long ranges:
-- Slow for 7+ days
-- Slow for 7+ days
SELECT COUNT(*) FROM key_verifications_v1 WHERE time >= now() - INTERVAL 7 DAY

-- Fast for 7+ days
-- Fast for 7+ days
SELECT SUM(count) FROM key_verifications_per_day_v1 WHERE time >= now() - INTERVAL 7 DAY
```

Expand Down Expand Up @@ -68,10 +68,10 @@ LIMIT 100 -- Add LIMIT for large datasets
### Missing Property 'query'

```json
// Wrong field name
// Wrong field name
{"sql": "SELECT COUNT(*) FROM key_verifications_v1"}

// Correct field name
// Correct field name
{"query": "SELECT COUNT(*) FROM key_verifications_v1"}
```

Expand Down Expand Up @@ -118,13 +118,13 @@ See [invalid_input](/errors/unkey/application/invalid_input) for API request for
### Filter Before Grouping

```sql
-- Less efficient
-- Less efficient
SELECT external_id, SUM(count) as usage
FROM key_verifications_per_day_v1
GROUP BY external_id
HAVING SUM(count) > 1000

-- More efficient
-- More efficient
SELECT external_id, SUM(count) as usage
FROM key_verifications_per_day_v1
WHERE time >= now() - INTERVAL 30 DAY -- Filter first
Expand Down
4 changes: 3 additions & 1 deletion apps/docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,11 @@
"pages": [
"analytics/overview",
"analytics/getting-started",
"analytics/quick-reference",
"analytics/query-examples",
"analytics/schema-reference",
"analytics/query-restrictions"
"analytics/query-restrictions",
"analytics/troubleshooting"
]
}
]
Expand Down
Loading