liveBook · Manning

Summarize

As explained in DuckDB in Action

SUMMARIZE is a DuckDB SQL command that reports descriptive statistics and metadata for a table, query result, or supported data file.

SUMMARIZE is a fast first-pass profiling command for understanding a dataset before building analytical queries. It reports per-column types, counts, ranges, distributions, approximate distinct counts, and missing-value percentages. section 1.7.3 section 4.2

Use SUMMARIZE to inspect:

  • Tables, query results, CSV files, and Parquet files, without necessarily ingesting the source first. section 4.2
  • Column types, count, minimum, maximum, average, standard deviation, approximate unique values, quartiles, and null percentage. section 1.7.3
  • Potential quality problems, such as negative distances or implausible ranges, before filtering or deeper analysis. section 10.4.5

Profile a filtered query

SUMMARIZE (SELECT read_on, power FROM readings WHERE system_id = 1200); reports timestamp coverage and power distribution for one system. In line mode, each column’s statistics are easy to inspect. For large remote datasets, summarizing only trip_distance or filtering through a view can reduce the data read, although computing statistics may still require scanning actual values. section 4.2 section 10.4.5

┌─────────────┬───────────────┬─────────────────────┬───┬─────────┬───────┐
│ column_name │  column_type  │         max         │ … │   q75   │ count │
│   varchar   │    varchar    │       varchar       │   │ varchar │ int64 │
├─────────────┼───────────────┼─────────────────────┼───┼─────────┼───────┤
│ system_id   │ INTEGER       │ 1200                │ … │ 1200    │ 151879│
│ read_on     │ TIMESTAMP     │ 2020-06-26 11:00:00 │ … │         │ 151879│
│ power       │ DECIMAL(10,3) │ 133900.000          │ … │ 5125    │ 151879│
└─────────────┴───────────────┴─────────────────────┴───┴─────────┴───────┘

A compact result table makes column types, ranges, quartiles, and counts visible at a glance. section 4.2

How DuckDB in Action covers it

How deep it goes
Reports detailed per-column statistics and scan costs, but does not replace custom aggregations, filters, or query-plan inspection.
Examples
Demonstrates readings filtered by system, taxi trip distances, S3-backed Parquet views, and line-mode CLI output.
What it assumes
Operates through DuckDB SQL or CLI commands against tables, queries, and supported files.
What you can do after
Diagnose/debug with it: identify missing values, implausible ranges, outliers, and suitable columns for subsequent analysis.
How it connects
Connects dataset profiling with DESCRIBE, aggregate functions, views, Parquet metadata, and predicate and projection pushdown.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of DuckDB in Action. The section links point to the parts of the book it draws on.