@@ -227,6 +227,38 @@ For type: `anyarray`
227
227
228
228
This operator class stores` anyarrray ` elements with length of the array.
229
229
Supports operators` && ` ,` @> ` ,` <@ ` ,` = ` ,` % ` operators. Supports ordering by` <=> ` operator.
230
+ For example we have the table:
231
+
232
+ ``` sql
233
+ CREATE TABLE test_array (i int2[]);
234
+
235
+ INSERT INTO test_arrayVALUES (' {}' ), (' {0}' ), (' {1,2,3,4}' ), (' {1,2,3}' ), (' {1,2}' ), (' {1}' );
236
+
237
+ CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
238
+ ```
239
+
240
+ Now we can execute the query using index scan:
241
+
242
+ ``` sql
243
+ SET enable_seqscan TO off;
244
+
245
+ EXPLAIN (COSTS OFF)SELECT * FROM test_arrayWHERE i &&' {1}' ORDER BY i<=> ' {1}' ASC ;
246
+ QUERY PLAN
247
+ -- ----------------------------------------
248
+ Index Scan using idx_arrayon test_array
249
+ Index Cond: (i &&' {1}' ::smallint [])
250
+ Order By : (i<=> ' {1}' ::smallint [])
251
+ (3 rows
252
+
253
+ SELECT * FROM test_arrayWHERE i &&' {1}' ORDER BY i<=> ' {1}' ASC ;
254
+ i
255
+ -- ---------
256
+ {1 }
257
+ {1 ,2 }
258
+ {1 ,2 ,3 }
259
+ {1 ,2 ,3 ,4 }
260
+ (4 rows)
261
+ ```
230
262
231
263
###rum_anyarray_addon_ops
232
264