@@ -2,6 +2,7 @@ CREATE TABLE atsts (id int, t tsvector, d timestamp);
22\copy atsts from 'data/tsts.data'
33CREATE INDEX atsts_idx ON atsts USING rum (t rum_tsvector_addon_ops, d)
44 WITH (attach = 'd', to = 't', order_by_attach='t');
5+ ERROR: doesn't support order index over pass-by-reference column
56INSERT INTO atsts VALUES (-1, 't1 t2', '2016-05-02 02:24:22.326724');
67INSERT INTO atsts VALUES (-2, 't1 t2 t3', '2016-05-02 02:26:22.326724');
78SELECT count(*) FROM atsts WHERE t @@ 'wr|qh';
@@ -118,14 +119,12 @@ RESET enable_bitmapscan;
118119SET enable_seqscan = off;
119120EXPLAIN (costs off)
120121SELECT count(*) FROM atsts WHERE t @@ 'wr|qh';
121- QUERY PLAN
122- -------------------------------------------------------------
122+ QUERY PLAN
123+ ---------------------------------------------------
123124 Aggregate
124- -> Bitmap Heap Scan on atsts
125- Recheck Cond: (t @@ '''wr'' | ''qh'''::tsquery)
126- -> Bitmap Index Scan on atsts_idx
127- Index Cond: (t @@ '''wr'' | ''qh'''::tsquery)
128- (5 rows)
125+ -> Seq Scan on atsts
126+ Filter: (t @@ '''wr'' | ''qh'''::tsquery)
127+ (3 rows)
129128
130129SELECT count(*) FROM atsts WHERE t @@ 'wr|qh';
131130 count
@@ -165,14 +164,12 @@ SELECT count(*) FROM atsts WHERE t @@ '(eq|yt)&(wr|qh)';
165164
166165EXPLAIN (costs off)
167166SELECT count(*) FROM atsts WHERE d < '2016-05-16 14:21:25';
168- QUERY PLAN
169- -----------------------------------------------------------------------------------------
167+ QUERY PLAN
168+ -------------------------------------------------------------------------------
170169 Aggregate
171- -> Bitmap Heap Scan on atsts
172- Recheck Cond: (d < 'Mon May 16 14:21:25 2016'::timestamp without time zone)
173- -> Bitmap Index Scan on atsts_idx
174- Index Cond: (d < 'Mon May 16 14:21:25 2016'::timestamp without time zone)
175- (5 rows)
170+ -> Seq Scan on atsts
171+ Filter: (d < 'Mon May 16 14:21:25 2016'::timestamp without time zone)
172+ (3 rows)
176173
177174SELECT count(*) FROM atsts WHERE d < '2016-05-16 14:21:25';
178175 count
@@ -182,14 +179,12 @@ SELECT count(*) FROM atsts WHERE d < '2016-05-16 14:21:25';
182179
183180EXPLAIN (costs off)
184181SELECT count(*) FROM atsts WHERE d > '2016-05-16 14:21:25';
185- QUERY PLAN
186- -----------------------------------------------------------------------------------------
182+ QUERY PLAN
183+ -------------------------------------------------------------------------------
187184 Aggregate
188- -> Bitmap Heap Scan on atsts
189- Recheck Cond: (d > 'Mon May 16 14:21:25 2016'::timestamp without time zone)
190- -> Bitmap Index Scan on atsts_idx
191- Index Cond: (d > 'Mon May 16 14:21:25 2016'::timestamp without time zone)
192- (5 rows)
185+ -> Seq Scan on atsts
186+ Filter: (d > 'Mon May 16 14:21:25 2016'::timestamp without time zone)
187+ (3 rows)
193188
194189SELECT count(*) FROM atsts WHERE d > '2016-05-16 14:21:25';
195190 count
@@ -199,59 +194,95 @@ SELECT count(*) FROM atsts WHERE d > '2016-05-16 14:21:25';
199194
200195EXPLAIN (costs off)
201196SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
202- QUERY PLAN
203- -----------------------------------------------------------------------------------
197+ QUERY PLAN
198+ -------------------------------------------------------------------------------------
204199 Limit
205- -> Index Scan using atsts_idx on atsts
206- Index Cond: (t @@ '''wr'' & ''qh'''::tsquery)
207- Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
208- (4 rows)
200+ -> Sort
201+ Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone))
202+ -> Seq Scan on atsts
203+ Filter: (t @@ '''wr'' & ''qh'''::tsquery)
204+ (5 rows)
209205
210206SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
211- ERROR: doesn't support order by over pass-by-reference column
207+ id | d | ?column?
208+ -----+---------------------------------+---------------
209+ 355 | Mon May 16 14:21:22.326724 2016 | 2.673276
210+ 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
211+ 371 | Tue May 17 06:21:22.326724 2016 | 57597.326724
212+ 406 | Wed May 18 17:21:22.326724 2016 | 183597.326724
213+ 415 | Thu May 19 02:21:22.326724 2016 | 215997.326724
214+ (5 rows)
215+
212216EXPLAIN (costs off)
213217SELECT id, d, d <=| '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d <=| '2016-05-16 14:21:25' LIMIT 5;
214- QUERY PLAN
215- -----------------------------------------------------------------------------------
218+ QUERY PLAN
219+ -------------------------------------------------------------------------------------
216220 Limit
217- -> Index Scan using atsts_idx on atsts
218- Index Cond: (t @@ '''wr'' & ''qh'''::tsquery)
219- Order By: (d <=| 'Mon May 16 14:21:25 2016'::timestamp without time zone)
220- (4 rows)
221+ -> Sort
222+ Sort Key: ((d <=| 'Mon May 16 14:21:25 2016'::timestamp without time zone))
223+ -> Seq Scan on atsts
224+ Filter: (t @@ '''wr'' & ''qh'''::tsquery)
225+ (5 rows)
221226
222227SELECT id, d, d <=| '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d <=| '2016-05-16 14:21:25' LIMIT 5;
223- ERROR: doesn't support order by over pass-by-reference column
228+ id | d | ?column?
229+ -----+---------------------------------+---------------
230+ 355 | Mon May 16 14:21:22.326724 2016 | 2.673276
231+ 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
232+ 252 | Thu May 12 07:21:22.326724 2016 | 370802.673276
233+ 232 | Wed May 11 11:21:22.326724 2016 | 442802.673276
234+ 168 | Sun May 08 19:21:22.326724 2016 | 673202.673276
235+ (5 rows)
236+
224237EXPLAIN (costs off)
225238SELECT id, d, d |=> '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5;
226- QUERY PLAN
227- -----------------------------------------------------------------------------------
239+ QUERY PLAN
240+ -------------------------------------------------------------------------------------
228241 Limit
229- -> Index Scan using atsts_idx on atsts
230- Index Cond: (t @@ '''wr'' & ''qh'''::tsquery)
231- Order By: (d |=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
232- (4 rows)
242+ -> Sort
243+ Sort Key: ((d |=> 'Mon May 16 14:21:25 2016'::timestamp without time zone))
244+ -> Seq Scan on atsts
245+ Filter: (t @@ '''wr'' & ''qh'''::tsquery)
246+ (5 rows)
233247
234248SELECT id, d, d |=> '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5;
235- ERROR: doesn't support order by over pass-by-reference column
249+ id | d | ?column?
250+ -----+---------------------------------+---------------
251+ 371 | Tue May 17 06:21:22.326724 2016 | 57597.326724
252+ 406 | Wed May 18 17:21:22.326724 2016 | 183597.326724
253+ 415 | Thu May 19 02:21:22.326724 2016 | 215997.326724
254+ 428 | Thu May 19 15:21:22.326724 2016 | 262797.326724
255+ 457 | Fri May 20 20:21:22.326724 2016 | 367197.326724
256+ (5 rows)
257+
236258EXPLAIN (costs off)
237259SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
238- QUERY PLAN
239- -----------------------------------------------------------------------------------
260+ QUERY PLAN
261+ -------------------------------------------------------------------------------------
240262 Limit
241- -> Index Scan using atsts_idx on atsts
242- Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
243- (3 rows)
263+ -> Sort
264+ Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone))
265+ -> Seq Scan on atsts
266+ (4 rows)
244267
245268SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
246- ERROR: doesn't support order by over pass-by-reference column
269+ id | d | ?column?
270+ -----+---------------------------------+-------------
271+ 355 | Mon May 16 14:21:22.326724 2016 | 2.673276
272+ 356 | Mon May 16 15:21:22.326724 2016 | 3597.326724
273+ 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276
274+ 357 | Mon May 16 16:21:22.326724 2016 | 7197.326724
275+ 353 | Mon May 16 12:21:22.326724 2016 | 7202.673276
276+ (5 rows)
277+
247278EXPLAIN (costs off)
248279SELECT id, d FROM atsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
249- QUERY PLAN
250- ----------------------------------------------------------------------------------------------------------------------------
280+ QUERY PLAN
281+ ------------------------------------------------------------------------------------------------------------------------
251282 Sort
252283 Sort Key: d
253- -> Index Scan using atsts_idx on atsts
254- Index Cond : ((t @@ '''wr'' & ''qh'''::tsquery) AND (d <= 'Mon May 16 14:21:25 2016'::timestamp without time zone))
284+ -> Seq Scan on atsts
285+ Filter : ((t @@ '''wr'' & ''qh'''::tsquery) AND (d <= 'Mon May 16 14:21:25 2016'::timestamp without time zone))
255286(4 rows)
256287
257288SELECT id, d FROM atsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d;
@@ -270,12 +301,12 @@ SELECT id, d FROM atsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER
270301
271302EXPLAIN (costs off)
272303SELECT id, d FROM atsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d;
273- QUERY PLAN
274- ----------------------------------------------------------------------------------------------------------------------------
304+ QUERY PLAN
305+ ------------------------------------------------------------------------------------------------------------------------
275306 Sort
276307 Sort Key: d
277- -> Index Scan using atsts_idx on atsts
278- Index Cond : ((t @@ '''wr'' & ''qh'''::tsquery) AND (d >= 'Mon May 16 14:21:25 2016'::timestamp without time zone))
308+ -> Seq Scan on atsts
309+ Filter : ((t @@ '''wr'' & ''qh'''::tsquery) AND (d >= 'Mon May 16 14:21:25 2016'::timestamp without time zone))
279310(4 rows)
280311
281312SELECT id, d FROM atsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d;
0 commit comments