(本this question一部分,但它是有点文不对题,所以我决定把它自身的问题。)符〜<〜Postgres里
我找不到什么操作~<~
是。 Postgres手册只提及~
和类似的运算符here,但没有符号~<~
。
当PSQL控制台摆弄,我发现,这些命令给了相同的结果:
SELECT * FROM test ORDER BY name USING ~<~;
SELECT * FROM test ORDER BY name COLLATE "C";
而且这些给出了相反的顺序:
SELECT * FROM test ORDER BY name USING ~>~;
SELECT * FROM test ORDER BY name COLLATE "C" DESC;
而且在波浪运营商的一些信息:
\do ~*~
List of operators
Schema | Name | Left arg type | Right arg type | Result type | Description
------------+------+---------------+----------------+-------------+-------------------------
pg_catalog | ~<=~ | character | character | boolean | less than or equal
pg_catalog | ~<=~ | text | text | boolean | less than or equal
pg_catalog | ~<~ | character | character | boolean | less than
pg_catalog | ~<~ | text | text | boolean | less than
pg_catalog | ~>=~ | character | character | boolean | greater than or equal
pg_catalog | ~>=~ | text | text | boolean | greater than or equal
pg_catalog | ~>~ | character | character | boolean | greater than
pg_catalog | ~>~ | text | text | boolean | greater than
pg_catalog | ~~ | bytea | bytea | boolean | matches LIKE expression
pg_catalog | ~~ | character | text | boolean | matches LIKE expression
pg_catalog | ~~ | name | text | boolean | matches LIKE expression
pg_catalog | ~~ | text | text | boolean | matches LIKE expression
(12 rows)
第3行和第4行是我正在查找的操作员,但是desc ription对我来说有点不足。
该运营商正在使用的Postgres的查询,如果你有一个的opclass指数。 http://www.postgresql.org/docs/9.5/static/indexes-opclass.html –
在'test(name text_pattern_ops)'上创建一个索引并查看'name LIKE'的'EXPLAIN'输出abc%'' –