Re:Pgvector – vector similarity search for Postgres
by eloff on Thursday April 22, 2021 @12:35PM
(#26904732)
I agree, I never remember the syntax for the json operators either. I'd rather functions which are readable if you don't remember what they do. Operators need to be looked up. This emphasis on terseness over readability was one of the reasons I abandoned perl long ago.
Re:Pgvector – vector similarity search for Postgres
by PeterisP on Thursday April 22, 2021 @04:31PM
(#26907805)
JSON query operators are somewhat unusual because it's very common to need to chain many operators in a row, which would be very verbose if named functions would be used instead - the vector similarity is different in this regard, and that terseness isn't necessary.
Re:Pgvector – vector similarity search for Postgres
by jononor on Thursday April 22, 2021 @01:36PM
(#26905490)
Yeah, I would love to be able to use functions for these vector distance operations instead of the very magical operators...
Re:Pgvector – vector similarity search for Postgres
by megous on Thursday April 22, 2021 @03:31PM
(#26907102)
https://github.com/ankane/pgvector/blob/master/vector--0.1.0...
Nothing stops you. All operators are implemented just as procedure calls.
The PostgreSQL world really loves operators - this extension uses <#>, <-> and <=> for example
I've been working with PostgreSQL JSON queries a bit recently which is also really operator heavy: https://www.postgresql.org/docs/13/functions-json.html - ->, ->>, #>, #>>
I have a really hard time remember what any of these do - I personally much prefer to use function equivalents like json_extract_path() if they are available.