View Full Version : username in lots of tables
April 29th, 2005, 11:09 PM
I see lots of references to "username" in these tables. Why is that? If someone changes there username, what will happen to all these pictures, posts etc. that rely on username? Why not just use the userid as the foreign key and get the name from the one table that should be allowed to have the username, "user"?
April 29th, 2005, 11:18 PM
There's an option under the gallery maintenance to refresh those if you change any usernames.
I assume it's done to cut down on database hits doing all those joins... Dunno.
April 29th, 2005, 11:21 PM
i don't think that's a good idea. a join is nothing. I think i may change the queries for myself.
April 29th, 2005, 11:23 PM
Why add work for yourself? Do you have people changing their names all the time? I get maybe 2 name change requests a year.
April 29th, 2005, 11:38 PM
yes, i do. few a month. as a graduate in db design & dev, it just irks me to see bad db design. no offence to any of the devs, it's still great work. I noticed also that one of the username fields had a datatype of TEXT. thats a lot of space being reserved for nothing. It was prolly just an oversight tho.
April 29th, 2005, 11:41 PM
So did you change all the same stuff in vBulletin itself too?
thread table has postuserid, along with postusername, and lastposter is the text name of the user as well.
forum table stores the whole title of the last posted thread, along with the threadid, and also keeps up with the lastposter userid and username.
All this is done for a reason... Lots of joins will kill you in a high traffic situation. (But, you already know that since you're a graduate of database design. ;) )
April 29th, 2005, 11:51 PM
(PhotoPost does it in a few places also, btw.)
April 30th, 2005, 10:58 AM
As ConqSoft said, it's to cut down on the number of joins and strain on the server. Which is more expensive, extra server space, or a better server? Even on my personal site with over 10,000 images the adv_gallery_images table only takes up 1.4mb.
Where are you seeing a useraname column that's defined as a text column? I just looked through the database structure and I'm not seeing one...
vBulletin® v3.8.1, Copyright ©2000-2014, Jelsoft Enterprises Ltd.