Sample Header Ad - 728x90

JOIN vs. WHERE Special Case - Single Target Foreign Key

0 votes
1 answer
45 views
Consider: - table A with primary key "id" and unique key "name" - table B with foreign key "aid" referencing A."id" - function (plpgsql) "f_name2id" taking some "name" and returning the matching "id" Which of the following would be more efficient? 1) SELECT * FROM B WHERE "aid" = f_name2id(); 2) SELECT B.* FROM B INNER JOIN A ON B."aid" = A."id" WHERE A."name" = ;
Asked by giladrv (103 rep)
Oct 28, 2024, 07:13 AM
Last activity: Oct 28, 2024, 07:35 AM