---
title: "Time-Series Quick Start Guide"
---

# Time-Series Quick Start Guide

**Time to Complete**: 10 minutes
**Prerequisites**: HeliosDB installed

---

## Overview

This guide will help you get started with HeliosDB's time-series capabilities. You will learn to:
1. Create a time-series table
2. Write time-series data points
3. Query time ranges
4. Configure retention policies
5. Set up downsampling

---

## Using SQL Interface

HeliosDB supports time-series operations through SQL:

### Create Time-Series Table

```sql
-- Create a time-series optimized table
CREATE TABLE sensor_readings (
    timestamp TIMESTAMPTZ NOT NULL,
    sensor_id VARCHAR(64) NOT NULL,
    temperature DOUBLE PRECISION,
    humidity DOUBLE PRECISION
) WITH (
    partition_by = 'DAY',
    retention = '30 days',
    compression = 'gorilla'
);
```

### Insert Data

```sql
-- Insert sensor readings
INSERT INTO sensor_readings (timestamp, sensor_id, temperature, humidity)
VALUES
    (NOW(), 'sensor-001', 23.5, 65.0),
    (NOW(), 'sensor-002', 24.1, 62.5);
```

### Query with Time Bucket

```sql
-- Aggregate by 5-minute buckets
SELECT
    time_bucket('5 minutes', timestamp) AS bucket,
    sensor_id,
    AVG(temperature) AS avg_temp,
    MAX(temperature) AS max_temp
FROM sensor_readings
WHERE timestamp > NOW() - INTERVAL '1 day'
GROUP BY bucket, sensor_id
ORDER BY bucket DESC;
```

### Configure Retention via SQL

```sql
-- Set retention policy
ALTER TABLE sensor_readings
SET RETENTION POLICY '30 days';

-- Set downsampling
ALTER TABLE sensor_readings
ADD CONTINUOUS AGGREGATE sensor_readings_1h
    EVERY '1 hour'
    WITH (aggregation = 'avg');
```

---

## Next Steps

| Topic | Guide |
|-------|-------|
| Complete documentation | USER_GUIDE.md |
| Code examples | [EXAMPLES.md](https://www.heliosdb.com/docs/full/features/time-series/examples/) |
| Performance optimization | ../timeseries/PERFORMANCE_TUNING.md |

---

**See Also**: [README.md](https://www.heliosdb.com/docs/full/features/time-series/readme/) | User Guide | [Examples](https://www.heliosdb.com/docs/full/features/time-series/examples/)
