Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
1 Mio in 3 Jahren entspricht Daumen x Pi ~ 2000 Datensätze / Tag.
Wenn es da Probleme gibt kann man das in den Griff bekommen.
edb=# create table messung(ts timestamp, value int);
CREATE TABLE
edb=*# insert into messung select '2010-01-01'::date + '5 minutes'::interval * s, random() *10000 from generate_series(1,10000000)s;
INSERT 0 10000000
edb=*# create index idx_ts on messung (ts);
CREATE INDEX
edb=*# commit;
COMMIT
edb=*# select max(ts) from messung ;
max
---------------------
2105-01-25 05:20:00
(1 row)
edb=*# explain analyse select sum(value) from messung where ts between '2020-01-01' and '2020-01-02';
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------
Aggregate (cost=15.71..15.72 rows=1 width=8) (actual time=0.342..0.343 rows=1 loops=1)
-> Index Scan using idx_ts on messung (cost=0.43..15.01 rows=279 width=4) (actual time=0.080..0.255 rows=289 loops=1)
Index Cond: ((ts >= '2020-01-01 00:00:00'::timestamp without time zone) AND (ts <= '2020-01-02 00:00:00'::timestamp without time zone))
Planning Time: 0.736 ms
Execution Time: 0.394 ms
(5 rows)
edb=*# explain analyse select sum(value) from messung where ts between '2099-01-01' and '2099-01-02';
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------
Aggregate (cost=16.48..16.49 rows=1 width=8) (actual time=0.446..0.448 rows=1 loops=1)
-> Index Scan using idx_ts on messung (cost=0.43..15.69 rows=313 width=4) (actual time=0.167..0.350 rows=289 loops=1)
Index Cond: ((ts >= '2099-01-01 00:00:00'::timestamp without time zone) AND (ts <= '2099-01-02 00:00:00'::timestamp without time zone))
Planning Time: 0.168 ms
Execution Time: 0.500 ms
(5 rows)
edb=*#
edb=*# create table messung(ts timestamp, value int);
CREATE TABLE
edb=*# insert into messung select '2010-01-01'::date + '5 seconds'::interval * s, random() *10000 from generate_series(1,25000000)s;
INSERT 0 25000000
edb=*# create index idx_ts on messung (ts);
CREATE INDEX
edb=*# select max(ts) from messung ;
max
---------------------
2013-12-17 18:13:20
(1 row)
edb=*# explain analyse select sum(value) from messung where ts between '2012-01-01' and '2012-01-02';
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------
Aggregate (cost=735.76..735.77 rows=1 width=8) (actual time=5.539..5.540 rows=1 loops=1)
-> Index Scan using idx_ts on messung (cost=0.44..688.84 rows=18770 width=4) (actual time=0.018..3.969 rows=17281 loops=1)
Index Cond: ((ts >= '2012-01-01 00:00:00'::timestamp without time zone) AND (ts <= '2012-01-02 00:00:00'::timestamp without time zone))
Planning Time: 0.165 ms
Execution Time: 5.567 ms
(5 rows)
edb=*#
Die Execution-times sind annähernd gleich.