The Archive Database
Scope: the file everything is for — the archive table and its 115 columns, what a record summarises, the daily summary tables beside it, and the SQLite-versus-MySQL choice the configuration offers.
One file
As generated, the whole memory of the
station is archive/weewx.sdb, an SQLite
database. Check: its size on the lab's first
afternoon, with the first handful of records
inside:
$ ls -l archive/weewx.sdb
-rw-r----- 1 root root 512000 ... weewx.sdb
512,000 bytes before the weather has done anything is SQLite's page allocation, not data: the schema is wide and the file takes its working room early. Growth after that is slow and honest — one record per interval, a few hundred bytes each. At the default five-minute interval a year is 105,120 records; stations a decade old carry databases in the hundreds of megabytes, and SQLite does not notice. The file can be copied while the engine is stopped — or, if you must, while it runs, accepting that the copy may miss the last interval — and that copy is a backup of the station's memory (chapter 10).
The archive table: 115 columns, most of them waiting
The archive table holds one row per
record. Its first columns are bookkeeping —
dateTime (the interval's end, as a Unix
timestamp), usUnits (the unit system the
row is stored in), interval (the length in
minutes) — and then one column per
observation the system knows about:
Check: counted and sampled on the lab
database (PRAGMA table_info(archive)):
115 columns, among them:
altimeter, appTemp, barometer, cloudbase, dewpoint, ET,
extraTemp1..8, hail, heatindex, inHumidity, inTemp,
lightning_strike_count, outHumidity, outTemp, pm2_5,
pressure, radiation, rain, rainRate, soilMoist1..4,
soilTemp1..4, UV, windchill, windDir, windGust,
windGustDir, windrun, windSpeed (and dozens more)
The width is a census of every sensor the WeeWX world has met: soil probes, leaf wetness, air-quality particulates, lightning counters, eight extra temperature channels. A given station fills the handful it owns and leaves the rest NULL — the lab's simulator, generous as it is, still left most columns empty. A NULL is not a zero: zero wind is a measurement, NULL is the honest absence of one, and reports treat them differently. That is why the table is wide rather than clever.
What a record summarises
A record is not a reading; it is the interval, summarised, and the summarising rule depends on the observation:
| Observation | In the record |
|---|---|
| temperature, humidity, pressure | the average over the interval |
| wind speed | the average; windGust keeps the strongest single reading |
| wind direction | the average direction; windGustDir where the gust came from |
| rain | the total that fell in the interval |
| rainRate | the highest rate seen |
The engine builds these from the interval's LOOP packets (chapter 1), weighted by time, which is why the lab's records could show a temperature of 32.66 °F that no single packet ever reported — it is the interval speaking, not a moment. Chapter 3's table of the first three records is the result.
The daily summaries: the second memory
Beside archive sit over a hundred small
tables named archive_day_<observation> —
one per observation. Each holds one row per
day with the day's statistics:
Check: the schema, and the lab's first day of outside temperature:
archive_day_outTemp columns:
dateTime, min, mintime, max, maxtime, sum, count, wsum, sumtime
2026-11-05: min 32.51 at 08:50:58, max 32.68 at 08:47:03,
sum 228.35 over 7 records, sumtime 420
Read the row and the machinery shows:
minimum and maximum with the times they
happened (the raw material of every "high
at 3:42 PM" line on the website); a sum
and count for averages; and wsum with
sumtime — the time-weighted sum and the
seconds it covers (here 420 = 7 records ×
60 seconds), so averages stay honest across
gaps and interval changes. archive_day_rain
keeps the same shape, its "sum" being the
day's rainfall.
The summaries are a cache, faithfully
maintained as each record lands, and they
exist so that a ten-year graph does not
require reading ten years of records. Being
a cache, they can be rebuilt: weectl
database rebuild-daily reconstructs them
from the archive (chapter 10), and the
engine backfills them at startup whenever it
finds them behind — the lab's first log
announced "Starting backfill of daily
summaries" over an empty database and moved
on. If the summaries and the archive ever
disagree, the archive is the truth and the
summaries are the ones that get rebuilt.
SQLite or MySQL
The generated configuration carries both:
[[archive_sqlite]], used by default, and a
commented path to [[archive_mysql]] with
driver = weedb.mysql. The choice is real
but narrower than it looks:
- SQLite is one file, needs no server, backs up with a copy, and is the right answer for the overwhelming majority of stations — including, demonstrably, this entire guide.
- MySQL/MariaDB earns its complexity when the database must be shared: reports generated on a different machine than the engine, several tools reading the weather at once, an existing database server already running the house.
Switching later is a data migration, not a
setting — weectl can create the new
database and the records can be carried
across, but the day is better spent not
needing to. Start with SQLite unless a
second machine is already in the plan.
A word on units inside the file
Records are stored in the unit system the
station was created with (the lab's rows say
usUnits = 1, US customary) and converted
at display time. The database, in other
words, does not care what the website shows:
a Seasons report can render °C from °F rows
without the file changing at all. What you
must not do is change the storage system
underneath existing data and expect the old
rows to reinterpret themselves — the
usUnits column on each row is the only
thing saying what its numbers mean.