1set enable_seqscan=off;
2CREATE TABLE test_timestamptz (
3	i timestamptz
4);
5INSERT INTO test_timestamptz 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' )
12;
13CREATE INDEX idx_timestamptz ON test_timestamptz USING gin (i);
14SELECT * FROM test_timestamptz WHERE i<'2004-10-26 08:55:08'::timestamptz ORDER BY i;
15              i
16------------------------------
17 Tue Oct 26 03:55:08 2004 PDT
18 Tue Oct 26 04:55:08 2004 PDT
19 Tue Oct 26 05:55:08 2004 PDT
20(3 rows)
21
22SELECT * FROM test_timestamptz WHERE i<='2004-10-26 08:55:08'::timestamptz ORDER BY i;
23              i
24------------------------------
25 Tue Oct 26 03:55:08 2004 PDT
26 Tue Oct 26 04:55:08 2004 PDT
27 Tue Oct 26 05:55:08 2004 PDT
28 Tue Oct 26 08:55:08 2004 PDT
29(4 rows)
30
31SELECT * FROM test_timestamptz WHERE i='2004-10-26 08:55:08'::timestamptz ORDER BY i;
32              i
33------------------------------
34 Tue Oct 26 08:55:08 2004 PDT
35(1 row)
36
37SELECT * FROM test_timestamptz WHERE i>='2004-10-26 08:55:08'::timestamptz ORDER BY i;
38              i
39------------------------------
40 Tue Oct 26 08:55:08 2004 PDT
41 Tue Oct 26 09:55:08 2004 PDT
42 Tue Oct 26 10:55:08 2004 PDT
43(3 rows)
44
45SELECT * FROM test_timestamptz WHERE i>'2004-10-26 08:55:08'::timestamptz ORDER BY i;
46              i
47------------------------------
48 Tue Oct 26 09:55:08 2004 PDT
49 Tue Oct 26 10:55:08 2004 PDT
50(2 rows)
51
52