SQL Logging
See every database query executed by your code.
Overview
The SQL panel captures all database queries during code execution, showing:
- Full SQL query text
- Parameter bindings
- Execution time
- Query count
Enabling SQL Logging
SQL logging is enabled by default. Toggle it with:
- Click the SQL toggle in the toolbar
- The toggle turns amber when active
Viewing Queries
After running code, queries appear in the SQL panel:
┌─────────────────────────────────────────────────┐
│ SQL Queries (3) 4.2ms │
├─────────────────────────────────────────────────┤
│ select * from `users` where `active` = ? │
│ Bindings: [true] 1.2ms │
├─────────────────────────────────────────────────┤
│ select * from `posts` where `user_id` in (?, ?) │
│ Bindings: [1, 2] 2.1ms │
├─────────────────────────────────────────────────┤
│ select count(*) from `comments` │
│ Bindings: [] 0.9ms │
└─────────────────────────────────────────────────┘Query Information
Each query shows:
SQL Text
The full query with placeholders (?) for bindings.
Bindings
The actual values substituted into the query:
sql
-- Query
select * from users where email = ? and active = ?
-- Bindings
["john@example.com", 1]
-- Actual executed query
select * from users where email = 'john@example.com' and active = 1Execution Time
Time in milliseconds for the query to execute.
Query Number
Sequential number showing execution order.
Slow Query Detection
Queries over a certain threshold are highlighted:
| Time | Indicator |
|---|---|
| < 10ms | Green |
| 10-100ms | Yellow |
| > 100ms | Red |
Related Features
- Database Explorer — Browse tables directly
- Code Execution — Run Tinker commands