什么是计算postgresql中相同日期之间天数的最简单方法

时间:2016-03-29 17:26:57

标签: postgresql

举一个例子,开始日期'2016-01-01'和结束日期'2016-06-01','10th'的天数是5,因为它出现在1月到5月的每个月。 “29日”的天数也是5天,因为它是闰年。 “30th”的天数为4天,“31th”的天数为3天,因为它们仅在某些月份出现。

根据开始和结束日期计算此数字的最简单(或最优雅)方法是什么?

1 个答案:

答案 0 :(得分:0)

您可以使用Register to memory mapping: RAX=0xffffffffffffffff is an unknown value RBX=0x0000000013d87190 is an unknown value RCX=0x0000000013e324f0 is an unknown value RDX=0x000000000000cdea is an unknown value RSP=0x00002b128ff68450 is pointing into the stack for thread: 0x000000002a36c000 RBP=0x00002b128ff68470 is pointing into the stack for thread: 0x000000002a36c000 RSI=0x00002b1264e160e0: <offset 0xfb10e0> in /usr/lib/jvm/jdk1.8.0_72/jre/lib/amd64/server/libjvm.so at 0x00002b1263e65000 RDI=0x0000000000000001 is an unknown value R8 =0x00002b1264e160e0: <offset 0xfb10e0> in /usr/lib/jvm/jdk1.8.0_72/jre/lib/amd64/server/libjvm.so at 0x00002b1263e65000 R9 =0x0000000000000001 is an unknown value R10=0x00002b1267d9568f is at entry_point+79 in (nmethod*)0x00002b1267d954d0 R11=0x0000000640825878 is an oop com.yourkit.probes.WeakKeyMap - klass: 'com/yourkit/probes/WeakKeyMap' R12= [error occurred during error reporting (printing register info), id 0xb] Stack: [0x00002b128feea000,0x00002b128ff6b000], sp=0x00002b128ff68450, free space=505k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x7ba491] JvmtiTagMap::get_tag(_jobject*)+0x51 V [libjvm.so+0x77f1e2] JvmtiEnv::GetTag(_jobject*, long*)+0x42 V [libjvm.so+0x736014] jvmti_GetTag+0x254 C [libyjpagent.so+0x1451ee] ObjectEnumerator::setObjectID(_jobject*, int)+0x3e Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) J 1246 com.yourkit.runtime.Callback.objectGetID(Ljava/lang/Object;)J (0 bytes) @ 0x00002b1267d9568f [0x00002b1267d95640+0x4f] J 7480 C2 com.yourkit.probes.ResourceCounter.open(Ljava/lang/Object;Ljava/lang/String;)V (133 bytes) @ 0x00002b1268d762e0 [0x00002b1268d76280+0x60] J 23584 C2 com.yourkit.probes.builtin.DatabasesLW$Connection_prepareStatement_Probe.onReturn(Ljava/lang/String;Ljava/sql/PreparedStatement;)V (43 bytes) @ 0x00002b126b38c28c [0x00002b126b38bfa0+0x2ec] J 8503 C2 oracle.jdbc.OracleConnectionWrapper.prepareStatement(Ljava/lang/String;)Ljava/sql/PreparedStatement; (158 bytes) @ 0x00002b1268f3322c [0x00002b1268f32aa0+0x78c] 创建日期列表,然后计算每天的发生次数:

generate_series()