My first post here; the forum came to my attention through the book Simply SQL by Rudy Limeback.
I have a question about the performance impact of JOIN. Let say you have two tables:
So fairly standard.
CREATE TABLE users
userid INT UNSIGNED NOT NULL PRIMARY KEY,
CREATE TABLE transactions
transactionid INT UNSIGNED NOT NULL PRIMARY KEY,
userid INT UNSIGNED,
Now most transactions queries will select the name corresponding to the userid, hence require a JOIN.
The alternative would be to set up the transactions table with the name of the user as an additional column. This would mean duplicate information, but might mean that SELECT statements are faster as that they don't require a JOIN.
Is the latter statement true? So can there be a situation where you should define the extra column (eg if the users table is large, and there are many transactions queries)?