SQL Queries
Execute SQL queries against your data using familiar ANSI SQL syntax. Infino supports a comprehensive SQL dialect for search, analytics, and complex data operations.
Endpoint
POST /sql
Content-Type: application/json
Optional Query Parameters:
start_time- RFC 3339 timestamp for time range filteringend_time- RFC 3339 timestamp for time range filteringresponse_type- Response format
Request Format
{
"query": "SELECT user_id, COUNT(*) FROM logs WHERE timestamp > '2024-01-01' GROUP BY user_id"
}
Response Format
{
"columns": [
{"name": "user_id", "type": "string"},
{"name": "COUNT(*)", "type": "long"}
],
"rows": [
["user123", 45],
["user456", 32]
],
"size": 2
}
Quick Start Example
SELECT level, COUNT(*) as count, AVG(response_time) as avg_time
FROM logs
WHERE timestamp >= '2024-01-01'
AND service = 'api-gateway'
GROUP BY level
HAVING COUNT(*) > 10
ORDER BY count DESC;
Response
{
"columns": [
{"name": "level", "type": "string"},
{"name": "count", "type": "long"},
{"name": "avg_time", "type": "double"}
],
"rows": [
["error", 156, 1250.5],
["warn", 89, 890.2],
["info", 45, 320.1]
],
"size": 3
}
Documentation Structure
Basic Queries
- SELECT, WHERE, ORDER BY, LIMIT
- CASE expressions and pattern matching
Joins and Relationships
- INNER, LEFT, RIGHT, FULL, CROSS JOINs
- Multi-table queries
Aggregations and Grouping
- COUNT, SUM, AVG, MIN, MAX functions
- GROUP BY and HAVING clauses
Advanced Functions
- Mathematical functions: ABS, ROUND, SQRT, POWER
- Geospatial: ST_DISTANCE, ST_POINT
- Vector similarity: KNN_SEARCH
Schema Discovery
- SHOW TABLES and DESCRIBE commands
- Data type analysis