我有一张桌子,看起来像这样:
create table room_server_metrics (
namespace varchar(36) not null,
session_id varchar(36) not null,
primary key (namespace, session_id),
created_at timestamptz not null default now(),
updated_at timestamptz not null default now(),
);
当我试着计算所有会话的长度时,我得到:
database=> select sum(updated_at - created_at) as total_time from room_server_metrics;
total_time
----------------------------
94 days 60951:01:56.381483
94天+60951小时是~2633天.
我不确定打印输出是否显示94天作为一个更容易阅读的指标,但如果我在几秒钟内打印出增量,我会得到以下结果:
database=> select extract(epoch from sum(updated_at - created_at)) as total_time from room_server_metrics;
total_time
----------------------------
227546617.181704
227546617.181704秒也就是~2633天.
为什么第一个查询不减少过go 94天的小时数?我不能为我的生活弄清楚这一点哈哈.
最大值