1
set enable_seqscan=off;
2
CREATE TABLE test_timestamp (
5
INSERT INTO test_timestamp VALUES
6
( '2004-10-26 03:55:08' ),
7
( '2004-10-26 04:55:08' ),
8
( '2004-10-26 05:55:08' ),
9
( '2004-10-26 08:55:08' ),
10
( '2004-10-26 09:55:08' ),
11
( '2004-10-26 10:55:08' )
13
CREATE INDEX idx_timestamp ON test_timestamp USING gin (i);
14
SELECT * FROM test_timestamp WHERE i<'2004-10-26 08:55:08'::timestamp ORDER BY i;
16
--------------------------
17
Tue Oct 26 03:55:08 2004
18
Tue Oct 26 04:55:08 2004
19
Tue Oct 26 05:55:08 2004
22
SELECT * FROM test_timestamp WHERE i<='2004-10-26 08:55:08'::timestamp ORDER BY i;
24
--------------------------
25
Tue Oct 26 03:55:08 2004
26
Tue Oct 26 04:55:08 2004
27
Tue Oct 26 05:55:08 2004
28
Tue Oct 26 08:55:08 2004
31
SELECT * FROM test_timestamp WHERE i='2004-10-26 08:55:08'::timestamp ORDER BY i;
33
--------------------------
34
Tue Oct 26 08:55:08 2004
37
SELECT * FROM test_timestamp WHERE i>='2004-10-26 08:55:08'::timestamp ORDER BY i;
39
--------------------------
40
Tue Oct 26 08:55:08 2004
41
Tue Oct 26 09:55:08 2004
42
Tue Oct 26 10:55:08 2004
45
SELECT * FROM test_timestamp WHERE i>'2004-10-26 08:55:08'::timestamp ORDER BY i;
47
--------------------------
48
Tue Oct 26 09:55:08 2004
49
Tue Oct 26 10:55:08 2004