# Tables

> Asense data is stored in seven tables. Each holds one kind of record, keyed by device ID and time.

Every record belongs to one device and one moment. You read a table by passing its name as `table_name`, together with the device `id` and a time window. The API converts the raw values the sensor sends into physical units before it answers, so the numbers you get are in g, degrees, millivolts and so on.

| Table | What it holds | Typical rate |
| --- | --- | --- |
| [`acc`](https://asense.semitronica.pt/docs/data-model/acc/) | Raw three-axis acceleration, plus temperature and wind at each packet | High rate, in packets of samples |
| [`gyr`](https://asense.semitronica.pt/docs/data-model/gyr/) | Raw three-axis angular rate | High rate, in packets of samples |
| [`ain`](https://asense.semitronica.pt/docs/data-model/ain/) | Two analog input channels, in millivolts | High rate, in packets of samples |
| [`fft`](https://asense.semitronica.pt/docs/data-model/fft/) | Acceleration spectra worked out on the sensor, one axis per record | Per measurement window |
| [`data`](https://asense.semitronica.pt/docs/data-model/data/) | Summary of each measurement window: averages, extremes, tilt, main frequencies, location | Usually one record per hour |
| [`env`](https://asense.semitronica.pt/docs/data-model/env/) | Environmental readings and power status: dust, noise, temperature, battery, solar | Usually one record every 10 minutes |
| [`connected`](https://asense.semitronica.pt/docs/data-model/connected/) | A log of the device connecting and disconnecting | When the connection changes |

Which tables a device fills depends on its type. A tilt and vibration sensor fills `acc`, `gyr`, `fft` and `data`. An environmental sensor fills `env`. An amplifier for external sensors fills `ain`.

## Fields every item has

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Device ID, such as `ASENSE00000005`. |
| `datetime` | string | Time of the item in ISO 8601, UTC, ending in `Z`. |
| `time` | integer | Same time in Unix milliseconds. Not present on `acc`, `gyr` and `ain` items, whose samples carry their own times. |

## Where a record's time comes from

Times are set on the device when the data is measured, not when it reaches the cloud. On the high-rate tables the time of a packet is the time of its last sample. [Timing and accuracy](https://asense.semitronica.pt/docs/timing-and-accuracy/) explains how the times of the other samples are worked out.

Source page: https://asense.semitronica.pt/docs/data-model/
