I was just writing a query when I thought of this. My query will yield exactly the same result using either inner join or left join, since I'm joining tables on a foreign key relationship, selecting first from the referenced table.
Below is a simplified example. Is there any difference (performance or otherwise) between the two queries?
I'm using postgres 9.5
Thanks
CREATE TABLE a(
a_id INT PRIMARY KEY,
a_name VARCHAR(10) NOT NULL
);
CREATE TABLE b(
b_id INT PRIMARY KEY,
a_id INT NOT NULL REFERENCES a(a_id),
b_data VARCHAR(50) NOT NULL
);
SELECT * FROM b INNER JOIN a ON b.b_id = a.a_id;
SELECT * FROM b LEFT JOIN a ON b.b_id = a.a_id;
EDIT Please note this is not a duplicate of This question, the reason being that I'm specifically asking about the situation when joinning from referencing to a referenced table in a foreign key relationship.