按查询优化组以检索每个用户的最新行
CREATE TABLE log ( log_date DATE, user_id INTEGER, payload INTEGER);
SELECT user_id, max(log_date), max(payload) FROM log WHERE log_date <= :mydate GROUP BY user_id
SELECT DISTINCT ON(user_id), log_date, payloadFROM logWHERE log_date <= :mydateORDER BY user_id, log_date DESC;
log(log_date)
users
payload > :value
).
www说
相关分类