我正在将响应存储在具有以下字段的mysql表中的各种rpc调用中:
Table: rpc_responses
timestamp (date)
method (varchar)
id (varchar)
response (mediumtext)
PRIMARY KEY(timestamp,method,id)
选择最近的方法和方法的所有现有组合的最佳方法是什么?
>对于每个日期,给定的方法/ id只能有一个响应。
>并非所有呼叫组合在给定日期都必须存在。
>有几十种方法,数千种ids和至少365个不同的日期
样品数据:
timestamp method id response
2009-01-10 getThud 16 "....."
2009-01-10 getFoo 12 "....."
2009-01-10 getBar 12 "....."
2009-01-11 getFoo 12 "....."
2009-01-11 getBar 16 "....."
所需结果:
2009-01-10 getThud 16 "....."
2009-01-10 getBar 12 "....."
2009-01-11 getFoo 12 "....."
2009-01-11 getBar 16 "....."
(我不认为this是同样的问题 – 它不会给我最新的回应)