Results 1 to 14 of 14
Thread: JOIN performance impact?
Dec 4, 2009, 01:53 #1
- Join Date
- Dec 2009
- 0 Post(s)
- 0 Thread(s)
JOIN performance impact?
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:
CREATE TABLE users ( userid INT UNSIGNED NOT NULL PRIMARY KEY, name VARCHAR(24), ... ) 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)?