跳转到主要内容

topn

type for top-n JSONB

topn : type for top-n JSONB

Overview

ID Extension Package Version Category License Language
4600 topn topn 2.7.1 FUNC AGPL-3.0 C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s-d-- No Yes No Yes no no

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT PGDG 2.7.1 19 18 17 16 15 topn -
RPM PGDG 2.7.1 19 18 17 16 15 topn_$v -
DEB PIGSTY 2.7.1 19 18 17 16 15 postgresql-$v-topn -
Linux / PG PG19 PG18 PG17 PG16 PG15
el8.x86_64 N/A PGDG 2.7.1 PGDG 2.7.1 PGDG 2.7.1 PGDG 2.7.1
el8.aarch64 N/A PGDG 2.7.1 PGDG 2.7.1 PGDG 2.7.1 PGDG 2.7.1
el9.x86_64 PGDG 2.7.1 PGDG 2.7.1 PGDG 2.7.1 PGDG 2.7.1 PGDG 2.7.1
el9.aarch64 PGDG 2.7.1 PGDG 2.7.1 PGDG 2.7.1 PGDG 2.7.1 PGDG 2.7.1
el10.x86_64 PGDG 2.7.1 PGDG 2.7.1 PGDG 2.7.1 PGDG 2.7.1 PGDG 2.7.1
el10.aarch64 PGDG 2.7.1 PGDG 2.7.1 PGDG 2.7.1 PGDG 2.7.1 PGDG 2.7.1
d12.x86_64 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1
d12.aarch64 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1
d13.x86_64 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1
d13.aarch64 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1
u22.x86_64 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1
u22.aarch64 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1
u24.x86_64 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1
u24.aarch64 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1
u26.x86_64 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1
u26.aarch64 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1 PIGSTY 2.7.1
Package Version OS ORG SIZE File URL
topn_19 2.7.1 el9.x86_64 pgdg 25.5 KiB topn_19-2.7.1-5PGDG.rhel9.9.x86_64.rpm
topn_19 2.7.1 el9.aarch64 pgdg 25.1 KiB topn_19-2.7.1-5PGDG.rhel9.9.aarch64.rpm
topn_19 2.7.1 el10.x86_64 pgdg 26.0 KiB topn_19-2.7.1-5PGDG.rhel10.3.x86_64.rpm
topn_19 2.7.1 el10.aarch64 pgdg 25.5 KiB topn_19-2.7.1-5PGDG.rhel10.3.aarch64.rpm
postgresql-19-topn 2.7.1 d12.x86_64 pigsty 30.5 KiB postgresql-19-topn_2.7.1-1PGSTY~bookworm_amd64.deb
postgresql-19-topn 2.7.1 d12.aarch64 pigsty 30.0 KiB postgresql-19-topn_2.7.1-1PGSTY~bookworm_arm64.deb
postgresql-19-topn 2.7.1 d13.x86_64 pigsty 30.5 KiB postgresql-19-topn_2.7.1-1PGSTY~trixie_amd64.deb
postgresql-19-topn 2.7.1 d13.aarch64 pigsty 30.1 KiB postgresql-19-topn_2.7.1-1PGSTY~trixie_arm64.deb
postgresql-19-topn 2.7.1 u22.x86_64 pigsty 31.3 KiB postgresql-19-topn_2.7.1-1PGSTY~jammy_amd64.deb
postgresql-19-topn 2.7.1 u22.aarch64 pigsty 31.2 KiB postgresql-19-topn_2.7.1-1PGSTY~jammy_arm64.deb
postgresql-19-topn 2.7.1 u24.x86_64 pigsty 31.0 KiB postgresql-19-topn_2.7.1-1PGSTY~noble_amd64.deb
postgresql-19-topn 2.7.1 u24.aarch64 pigsty 30.6 KiB postgresql-19-topn_2.7.1-1PGSTY~noble_arm64.deb
postgresql-19-topn 2.7.1 u26.x86_64 pigsty 30.9 KiB postgresql-19-topn_2.7.1-1PGSTY~resolute_amd64.deb
postgresql-19-topn 2.7.1 u26.aarch64 pigsty 30.7 KiB postgresql-19-topn_2.7.1-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
topn_18 2.7.1 el8.x86_64 pgdg 26.2 KiB topn_18-2.7.1-5PGDG.rhel8.10.x86_64.rpm
topn_18 2.7.1 el8.x86_64 pgdg 26.0 KiB topn_18-2.7.1-4PGDG.rhel8.10.x86_64.rpm
topn_18 2.7.0 el8.x86_64 pgdg 24.0 KiB topn_18-2.7.0-2PGDG.rhel8.x86_64.rpm
topn_18 2.7.1 el8.aarch64 pgdg 26.0 KiB topn_18-2.7.1-5PGDG.rhel8.10.aarch64.rpm
topn_18 2.7.1 el8.aarch64 pgdg 25.7 KiB topn_18-2.7.1-4PGDG.rhel8.10.aarch64.rpm
topn_18 2.7.1 el8.aarch64 pgdg 25.2 KiB topn_18-2.7.1-1PGDG.rhel8.10.aarch64.rpm
topn_18 2.7.0 el8.aarch64 pgdg 23.8 KiB topn_18-2.7.0-2PGDG.rhel8.aarch64.rpm
topn_18 2.7.1 el9.x86_64 pgdg 25.5 KiB topn_18-2.7.1-5PGDG.rhel9.9.x86_64.rpm
topn_18 2.7.1 el9.aarch64 pgdg 25.1 KiB topn_18-2.7.1-5PGDG.rhel9.9.aarch64.rpm
topn_18 2.7.1 el10.x86_64 pgdg 26.0 KiB topn_18-2.7.1-5PGDG.rhel10.3.x86_64.rpm
topn_18 2.7.1 el10.aarch64 pgdg 25.5 KiB topn_18-2.7.1-5PGDG.rhel10.3.aarch64.rpm
topn_18 2.7.1 el10.aarch64 pgdg 25.5 KiB topn_18-2.7.1-5PGDG.rhel10.2.aarch64.rpm
topn_18 2.7.1 el10.aarch64 pgdg 25.3 KiB topn_18-2.7.1-4PGDG.rhel10.2.aarch64.rpm
topn_18 2.7.1 el10.aarch64 pgdg 24.6 KiB topn_18-2.7.1-1PGDG.rhel10.2.aarch64.rpm
topn_18 2.7.0 el10.aarch64 pgdg 23.5 KiB topn_18-2.7.0-4PGDG.rhel10.2.aarch64.rpm
topn_18 2.7.0 el10.aarch64 pgdg 23.8 KiB topn_18-2.7.0-2PGDG.rhel10.aarch64.rpm
postgresql-18-topn 2.7.1 d12.x86_64 pigsty 30.4 KiB postgresql-18-topn_2.7.1-1PGSTY~bookworm_amd64.deb
postgresql-18-topn 2.7.1 d12.aarch64 pigsty 30.1 KiB postgresql-18-topn_2.7.1-1PGSTY~bookworm_arm64.deb
postgresql-18-topn 2.7.1 d13.x86_64 pigsty 30.5 KiB postgresql-18-topn_2.7.1-1PGSTY~trixie_amd64.deb
postgresql-18-topn 2.7.1 d13.aarch64 pigsty 30.1 KiB postgresql-18-topn_2.7.1-1PGSTY~trixie_arm64.deb
postgresql-18-topn 2.7.1 u22.x86_64 pigsty 31.5 KiB postgresql-18-topn_2.7.1-1PGSTY~jammy_amd64.deb
postgresql-18-topn 2.7.1 u22.aarch64 pigsty 31.3 KiB postgresql-18-topn_2.7.1-1PGSTY~jammy_arm64.deb
postgresql-18-topn 2.7.1 u24.x86_64 pigsty 30.9 KiB postgresql-18-topn_2.7.1-1PGSTY~noble_amd64.deb
postgresql-18-topn 2.7.1 u24.aarch64 pigsty 30.7 KiB postgresql-18-topn_2.7.1-1PGSTY~noble_arm64.deb
postgresql-18-topn 2.7.1 u26.x86_64 pigsty 31.0 KiB postgresql-18-topn_2.7.1-1PGSTY~resolute_amd64.deb
postgresql-18-topn 2.7.1 u26.aarch64 pigsty 30.7 KiB postgresql-18-topn_2.7.1-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
topn_17 2.7.1 el8.x86_64 pgdg 26.2 KiB topn_17-2.7.1-5PGDG.rhel8.10.x86_64.rpm
topn_17 2.7.1 el8.x86_64 pgdg 26.0 KiB topn_17-2.7.1-4PGDG.rhel8.10.x86_64.rpm
topn_17 2.7.0 el8.x86_64 pgdg 24.0 KiB topn_17-2.7.0-1PGDG.rhel8.x86_64.rpm
topn_17 2.7.1 el8.aarch64 pgdg 26.0 KiB topn_17-2.7.1-5PGDG.rhel8.10.aarch64.rpm
topn_17 2.7.1 el8.aarch64 pgdg 25.7 KiB topn_17-2.7.1-4PGDG.rhel8.10.aarch64.rpm
topn_17 2.7.1 el8.aarch64 pgdg 25.2 KiB topn_17-2.7.1-1PGDG.rhel8.10.aarch64.rpm
topn_17 2.7.0 el8.aarch64 pgdg 23.8 KiB topn_17-2.7.0-1PGDG.rhel8.aarch64.rpm
topn_17 2.7.1 el9.x86_64 pgdg 25.5 KiB topn_17-2.7.1-5PGDG.rhel9.9.x86_64.rpm
topn_17 2.7.1 el9.aarch64 pgdg 25.1 KiB topn_17-2.7.1-5PGDG.rhel9.9.aarch64.rpm
topn_17 2.7.1 el10.x86_64 pgdg 26.0 KiB topn_17-2.7.1-5PGDG.rhel10.3.x86_64.rpm
topn_17 2.7.1 el10.aarch64 pgdg 25.5 KiB topn_17-2.7.1-5PGDG.rhel10.3.aarch64.rpm
topn_17 2.7.1 el10.aarch64 pgdg 25.5 KiB topn_17-2.7.1-5PGDG.rhel10.2.aarch64.rpm
topn_17 2.7.1 el10.aarch64 pgdg 25.3 KiB topn_17-2.7.1-4PGDG.rhel10.2.aarch64.rpm
topn_17 2.7.1 el10.aarch64 pgdg 24.7 KiB topn_17-2.7.1-1PGDG.rhel10.2.aarch64.rpm
topn_17 2.7.0 el10.aarch64 pgdg 23.4 KiB topn_17-2.7.0-4PGDG.rhel10.2.aarch64.rpm
topn_17 2.7.0 el10.aarch64 pgdg 23.7 KiB topn_17-2.7.0-2PGDG.rhel10.aarch64.rpm
postgresql-17-topn 2.7.1 d12.x86_64 pigsty 30.5 KiB postgresql-17-topn_2.7.1-1PGSTY~bookworm_amd64.deb
postgresql-17-topn 2.7.1 d12.aarch64 pigsty 30.1 KiB postgresql-17-topn_2.7.1-1PGSTY~bookworm_arm64.deb
postgresql-17-topn 2.7.1 d13.x86_64 pigsty 30.5 KiB postgresql-17-topn_2.7.1-1PGSTY~trixie_amd64.deb
postgresql-17-topn 2.7.1 d13.aarch64 pigsty 30.2 KiB postgresql-17-topn_2.7.1-1PGSTY~trixie_arm64.deb
postgresql-17-topn 2.7.1 u22.x86_64 pigsty 34.9 KiB postgresql-17-topn_2.7.1-1PGSTY~jammy_amd64.deb
postgresql-17-topn 2.7.1 u22.aarch64 pigsty 34.9 KiB postgresql-17-topn_2.7.1-1PGSTY~jammy_arm64.deb
postgresql-17-topn 2.7.1 u24.x86_64 pigsty 31.0 KiB postgresql-17-topn_2.7.1-1PGSTY~noble_amd64.deb
postgresql-17-topn 2.7.1 u24.aarch64 pigsty 30.8 KiB postgresql-17-topn_2.7.1-1PGSTY~noble_arm64.deb
postgresql-17-topn 2.7.1 u26.x86_64 pigsty 31.0 KiB postgresql-17-topn_2.7.1-1PGSTY~resolute_amd64.deb
postgresql-17-topn 2.7.1 u26.aarch64 pigsty 30.8 KiB postgresql-17-topn_2.7.1-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
topn_16 2.7.1 el8.x86_64 pgdg 26.2 KiB topn_16-2.7.1-5PGDG.rhel8.10.x86_64.rpm
topn_16 2.7.1 el8.x86_64 pgdg 26.0 KiB topn_16-2.7.1-4PGDG.rhel8.10.x86_64.rpm
topn_16 2.7.0 el8.x86_64 pgdg 24.0 KiB topn_16-2.7.0-1PGDG.rhel8.x86_64.rpm
topn_16 2.6.0 el8.x86_64 pgdg 23.7 KiB topn_16-2.6.0-1PGDG.rhel8.x86_64.rpm
topn_16 2.7.1 el8.aarch64 pgdg 26.0 KiB topn_16-2.7.1-5PGDG.rhel8.10.aarch64.rpm
topn_16 2.7.1 el8.aarch64 pgdg 25.7 KiB topn_16-2.7.1-4PGDG.rhel8.10.aarch64.rpm
topn_16 2.7.1 el8.aarch64 pgdg 25.2 KiB topn_16-2.7.1-1PGDG.rhel8.10.aarch64.rpm
topn_16 2.7.0 el8.aarch64 pgdg 23.8 KiB topn_16-2.7.0-1PGDG.rhel8.aarch64.rpm
topn_16 2.6.0 el8.aarch64 pgdg 23.5 KiB topn_16-2.6.0-1PGDG.rhel8.aarch64.rpm
topn_16 2.7.1 el9.x86_64 pgdg 25.5 KiB topn_16-2.7.1-5PGDG.rhel9.9.x86_64.rpm
topn_16 2.7.1 el9.aarch64 pgdg 25.1 KiB topn_16-2.7.1-5PGDG.rhel9.9.aarch64.rpm
topn_16 2.7.1 el10.x86_64 pgdg 26.0 KiB topn_16-2.7.1-5PGDG.rhel10.3.x86_64.rpm
topn_16 2.7.1 el10.aarch64 pgdg 25.5 KiB topn_16-2.7.1-5PGDG.rhel10.3.aarch64.rpm
topn_16 2.7.1 el10.aarch64 pgdg 25.5 KiB topn_16-2.7.1-5PGDG.rhel10.2.aarch64.rpm
topn_16 2.7.1 el10.aarch64 pgdg 25.3 KiB topn_16-2.7.1-4PGDG.rhel10.2.aarch64.rpm
topn_16 2.7.1 el10.aarch64 pgdg 24.6 KiB topn_16-2.7.1-1PGDG.rhel10.2.aarch64.rpm
topn_16 2.7.0 el10.aarch64 pgdg 23.4 KiB topn_16-2.7.0-4PGDG.rhel10.2.aarch64.rpm
topn_16 2.7.0 el10.aarch64 pgdg 23.7 KiB topn_16-2.7.0-2PGDG.rhel10.aarch64.rpm
postgresql-16-topn 2.7.1 d12.x86_64 pigsty 30.5 KiB postgresql-16-topn_2.7.1-1PGSTY~bookworm_amd64.deb
postgresql-16-topn 2.7.1 d12.aarch64 pigsty 30.1 KiB postgresql-16-topn_2.7.1-1PGSTY~bookworm_arm64.deb
postgresql-16-topn 2.7.1 d13.x86_64 pigsty 30.6 KiB postgresql-16-topn_2.7.1-1PGSTY~trixie_amd64.deb
postgresql-16-topn 2.7.1 d13.aarch64 pigsty 30.2 KiB postgresql-16-topn_2.7.1-1PGSTY~trixie_arm64.deb
postgresql-16-topn 2.7.1 u22.x86_64 pigsty 34.8 KiB postgresql-16-topn_2.7.1-1PGSTY~jammy_amd64.deb
postgresql-16-topn 2.7.1 u22.aarch64 pigsty 34.7 KiB postgresql-16-topn_2.7.1-1PGSTY~jammy_arm64.deb
postgresql-16-topn 2.7.1 u24.x86_64 pigsty 31.0 KiB postgresql-16-topn_2.7.1-1PGSTY~noble_amd64.deb
postgresql-16-topn 2.7.1 u24.aarch64 pigsty 31.0 KiB postgresql-16-topn_2.7.1-1PGSTY~noble_arm64.deb
postgresql-16-topn 2.7.1 u26.x86_64 pigsty 30.9 KiB postgresql-16-topn_2.7.1-1PGSTY~resolute_amd64.deb
postgresql-16-topn 2.7.1 u26.aarch64 pigsty 30.8 KiB postgresql-16-topn_2.7.1-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
topn_15 2.7.1 el8.x86_64 pgdg 26.2 KiB topn_15-2.7.1-5PGDG.rhel8.10.x86_64.rpm
topn_15 2.7.1 el8.x86_64 pgdg 26.0 KiB topn_15-2.7.1-4PGDG.rhel8.10.x86_64.rpm
topn_15 2.7.0 el8.x86_64 pgdg 24.0 KiB topn_15-2.7.0-1PGDG.rhel8.x86_64.rpm
topn_15 2.4.0 el8.x86_64 pgdg 24.1 KiB topn_15-2.4.0-2.rhel8.x86_64.rpm
topn_15 2.7.1 el8.aarch64 pgdg 26.0 KiB topn_15-2.7.1-5PGDG.rhel8.10.aarch64.rpm
topn_15 2.7.1 el8.aarch64 pgdg 25.7 KiB topn_15-2.7.1-4PGDG.rhel8.10.aarch64.rpm
topn_15 2.7.1 el8.aarch64 pgdg 25.2 KiB topn_15-2.7.1-1PGDG.rhel8.10.aarch64.rpm
topn_15 2.7.0 el8.aarch64 pgdg 23.8 KiB topn_15-2.7.0-1PGDG.rhel8.aarch64.rpm
topn_15 2.4.0 el8.aarch64 pgdg 23.9 KiB topn_15-2.4.0-2.rhel8.aarch64.rpm
topn_15 2.7.1 el9.x86_64 pgdg 25.5 KiB topn_15-2.7.1-5PGDG.rhel9.9.x86_64.rpm
topn_15 2.7.1 el9.aarch64 pgdg 25.1 KiB topn_15-2.7.1-5PGDG.rhel9.9.aarch64.rpm
topn_15 2.7.1 el10.x86_64 pgdg 26.0 KiB topn_15-2.7.1-5PGDG.rhel10.3.x86_64.rpm
topn_15 2.7.1 el10.aarch64 pgdg 25.5 KiB topn_15-2.7.1-5PGDG.rhel10.3.aarch64.rpm
topn_15 2.7.1 el10.aarch64 pgdg 25.5 KiB topn_15-2.7.1-5PGDG.rhel10.2.aarch64.rpm
topn_15 2.7.1 el10.aarch64 pgdg 25.3 KiB topn_15-2.7.1-4PGDG.rhel10.2.aarch64.rpm
topn_15 2.7.1 el10.aarch64 pgdg 24.6 KiB topn_15-2.7.1-1PGDG.rhel10.2.aarch64.rpm
topn_15 2.7.0 el10.aarch64 pgdg 23.4 KiB topn_15-2.7.0-4PGDG.rhel10.2.aarch64.rpm
topn_15 2.7.0 el10.aarch64 pgdg 23.7 KiB topn_15-2.7.0-2PGDG.rhel10.aarch64.rpm
postgresql-15-topn 2.7.1 d12.x86_64 pigsty 30.4 KiB postgresql-15-topn_2.7.1-1PGSTY~bookworm_amd64.deb
postgresql-15-topn 2.7.1 d12.aarch64 pigsty 33.8 KiB postgresql-15-topn_2.7.1-1PGSTY~bookworm_arm64.deb
postgresql-15-topn 2.7.1 d13.x86_64 pigsty 30.4 KiB postgresql-15-topn_2.7.1-1PGSTY~trixie_amd64.deb
postgresql-15-topn 2.7.1 d13.aarch64 pigsty 30.1 KiB postgresql-15-topn_2.7.1-1PGSTY~trixie_arm64.deb
postgresql-15-topn 2.7.1 u22.x86_64 pigsty 34.9 KiB postgresql-15-topn_2.7.1-1PGSTY~jammy_amd64.deb
postgresql-15-topn 2.7.1 u22.aarch64 pigsty 34.7 KiB postgresql-15-topn_2.7.1-1PGSTY~jammy_arm64.deb
postgresql-15-topn 2.7.1 u24.x86_64 pigsty 30.8 KiB postgresql-15-topn_2.7.1-1PGSTY~noble_amd64.deb
postgresql-15-topn 2.7.1 u24.aarch64 pigsty 30.6 KiB postgresql-15-topn_2.7.1-1PGSTY~noble_arm64.deb
postgresql-15-topn 2.7.1 u26.x86_64 pigsty 30.9 KiB postgresql-15-topn_2.7.1-1PGSTY~resolute_amd64.deb
postgresql-15-topn 2.7.1 u26.aarch64 pigsty 30.7 KiB postgresql-15-topn_2.7.1-1PGSTY~resolute_arm64.deb

Source

pig build pkg topn;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install topn;		# install via package name, for the active PG version

pig install topn -v 19;   # install for PG 19
pig install topn -v 18;   # install for PG 18
pig install topn -v 17;   # install for PG 17
pig install topn -v 16;   # install for PG 16
pig install topn -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION topn;

Usage

topn: top-N values approximation for PostgreSQL

Provides approximate top-N value tracking using an approximation algorithm that keeps a predefined number of frequent items and counters. Supports materialization, incremental updates, and merging across time intervals.

CREATE EXTENSION topn;

Data Type

Uses JSONB to store the frequent items and their frequencies.

Aggregates

Function Description
topn_add_agg(text) Aggregate that creates a JSONB counter from a text column
topn_union_agg(jsonb) Aggregate that merges multiple JSONB counter lists

Functions

Function Description
topn(jsonb, n) Return the top-N elements and frequencies as rows
topn_add(jsonb, text) Add a text value to a JSONB counter
topn_union(jsonb, jsonb) Merge two JSONB counter lists

Configuration

  • topn.number_of_counters – number of counters to track (default: 1000)

Examples

-- Materialize top products by date
CREATE TABLE popular_products (
  review_date date UNIQUE,
  agg_data jsonb
);

INSERT INTO popular_products
SELECT review_date, topn_add_agg(product_id)
FROM customer_reviews GROUP BY review_date;

-- Get the top-1 product for each day
SELECT review_date, (topn(agg_data, 1)).*
FROM popular_products ORDER BY review_date;

-- Top 10 across a time range (merging daily summaries)
SELECT (topn(topn_union_agg(agg_data), 10)).*
FROM popular_products
WHERE review_date >= '2000-01-01' AND review_date < '2000-02-01'
ORDER BY 2 DESC;

表格阅读器