Important topic is missed: comparing composite types
От | PG Doc comments form |
---|---|
Тема | Important topic is missed: comparing composite types |
Дата | |
Msg-id | 175816236005.860.4057702842618093971@wrigleys.postgresql.org обсуждение исходный текст |
Список | pgsql-docs |
The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/17/rowtypes.html Description: I am working with composites and found that they are a bit slower in compare if I use separate columns. It would be nice if article will contain description of the best approach how to do comparison with composite types. Here below is just overview of the problem. CREATE TYPE tenant_ctx AS ( org_id int, unit_id int, user_id int ); Eg. (org_id, unit_id, user_id) = ( SELECT * FROM rls_guard_table_comp() ) # this returns tenant_ctx "(ouu) = (SEL * FROM fn()) <-- T Co; --> cs-ouu"; DO Time: 475,272 ms elapsed_ms ------------ 475.061 (1 row) Time: 0,044 ms branch = ( select Co from rls_guard_table_comp() Co ) # branch is tenant_ctx; "Co = (SEL Co FROM fn() Co) <-- T Co; --> cs-ouu"; DO Time: 1033,373 ms (00:01,033) elapsed_ms ------------ 1033.205 (1 row) Time: 0,114 ms ((branch).org_id, (branch).unit_id, (branch).user_id) = ( SELECT org_id, unit_id, user_id FROM rls_guard_table() ) "(Co.ouu) = (SEL ouu FROM fn()) <-- T ouu; --> cs-ouu"; DO Time: 824,334 ms elapsed_ms ------------ 824.137 (1 row)
В списке pgsql-docs по дате отправления: