![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Hi, I'm have the following query: select count(*) from delivery where "creation_date" <= TIMESTAMP '2003-04-01 00:00:00' and "creation_date" > TIMESTAMP '2003-03-01 00:00:00'; without any index the range query returns the correct result namely 272394, when i create an index on creation_date, I get 10371 as a result. I'm using 7.3.3 on Linux (gentoo). Any help appreciated, if you need more information I'm happy to provide it. Here is a transcript: gaiaperformance=> select count(*) from delivery where "creation_date" = TIMESTAMP '2003-04-01 00:00:00' and "creation_date" > TIMESTAMP '2003-03-01 00:00:00'; count -------- 272394 (1 row) gaiaperformance=> create index creation_date_ind on delivery (creation_date); CREATE INDEX gaiaperformance=> select count(*) from delivery where "creation_date" = TIMESTAMP '2003-04-01 00:00:00' and "creation_date" > TIMESTAMP '2003-03-01 00:00:00'; count ------- 10371 (1 row) christian ---------------------------------------------- Christian van der Leeden Logic United GmbH Tel: 089-189488-66 Mob: 0163-3747111 www.logicunited.com Christian van der Leeden.vcf ---------------------------------------------- Christian van der Leeden Logic United GmbH Tel: 089-189488-66 Mob: 0163-3747111 www.logicunited.com Christian van der Leeden.vcf ---------------------------------------------- |
#2
| |||
| |||
|
|
the reason for this misbehaviour was an invalid timestamp value. I've tried to dump/restore the db and the restore choked on a "incorrect timestamp" namely: 4714-11--2147483624 -2147483648:-2147483648:-2147483648 BC |
#3
| |||
| |||
|
|
Christian van der Leeden <lists (AT) logicunited (DOT) com> writes: the reason for this misbehaviour was an invalid timestamp value. I've tried to dump/restore the db and the restore choked on a "incorrect timestamp" namely: 4714-11--2147483624 -2147483648:-2147483648:-2147483648 BC Hmm ... I'm suspecting that that was a "minus infinity" under the hood. Is your installation built with integer timestamps, or floating point? (If you're not sure, try "pg_config --configure" and see if it mentions --enable-integer-datetimes.) Also, is the column in question of type timestamp, or timestamp with time zone? regards, tom lane ---------------------------------------------- |
#4
| |||
| |||
|
|
The db itself (only speaking for the current 7.3.4 build), is not configured with enabled-integer-datetimes. |
![]() |
| Thread Tools | |
| Display Modes | |
| |