Closed philippkraft closed 3 years ago
Test with https://fb09-pasig.umwelt.uni-giessen.de/schwingbach/dataset/5000
d = ds[5000]
30 seconds
d.records.order_by(db.Record.id.desc()).limit(1).scalar()
1 second
session.query(sql.func.max(db.Record.id)).filter_by(_dataset=d.id).scalar() or 0
16.5 ms
size = d.records.count()
maxid = next(d.records.order_by(db.Record.id).offset(size - 1).values('id'))[0]
https://github.com/jlu-ilr-hydro/odmf/blob/68d4fa8de1db0c5783b066d0570e459b7c4d2752/odmf/db/dataset.py#L415-L418
Eg for ecuador/dataset/10341
Not faster:
Much faster: