(本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%'' –