(oryginalnie częścią this question, ale było nieco znaczenia, więc postanowiłem zrobić to pytanie własnych.)Operator ~ <~ w PostgreSQL
nie mogę znaleźć co operator ~<~
jest. Podręcznik Postgres wymienia tylko ~
i podobnych operatorów here, ale nie ma znaku ~<~
.
Kiedy błahy w konsoli psql, okazało się, że polecenia te dają takie same wyniki:
SELECT * FROM test ORDER BY name USING ~<~;
SELECT * FROM test ORDER BY name COLLATE "C";
a te daje odwrotny Kolejność:
SELECT * FROM test ORDER BY name USING ~>~;
SELECT * FROM test ORDER BY name COLLATE "C" DESC;
również kilka informacji na tyldy operatorów :
\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)
Trzeci i czwarty wiersz to operator, którego szukam, ale opis ription jest dla mnie trochę niewystarczający.
Operator ten jest używany przez PostgreSQL dla odnośnika jeśli masz indeks z opclass. http://www.postgresql.org/docs/9.5/static/indexes-opclass.html –
Utwórz indeks na 'test (name text_pattern_ops)' i spójrz na wyjście 'EXPLAIN' dla' name LIKE 'abc%' ' –