Jump to content

Recommended Posts

Howdy all,

 

I'll say right off the bat that I can use mysql very proficiently when it comes to the basics, but I've never really pushed myself to learn much beyond that (even so much as joins), so I may be missing something incredibly obvious here.

 

Here's my basic problem... at a lot of points around the site, things will be credited to a specific person.  An example might be a post (in the form of a blog of sorts) on the index page.  It will indicate not only who wrote it, but what their user level is.

 

Originally, my plan was to put only the userid into the table for each row, and when collecting posts, I would just get the user's info out of the user table using their id.  However, I was looking at how phpbb does it, and I see that they actually include the username and color (the color ends up being about equivalent to the userlevel) in the actual row for the post.  If a user's color is changed, they perform an update on all the rows containing that user's id.

 

Now assuming a potential of a million users (yea right, lol), what's the most efficient way for me to go about this?  Put the username and userlevel in the post table?  Select it after I get the posts?  Something else I'm not thinking of?

 

Thank you!

James

Link to comment
https://forums.phpfreaks.com/topic/142559-usernameuserlevel-in-individual-posts/
Share on other sites

The logic behind PHPBB is actually fairly sound as long as the number of users is small.

 

 

If you have to pull it each page load, well... that is an extra query for each name for each page.  That could add up quickly.  But, of course updating can become a pain if there are 10000 things that have that person's name in it.  Also, the name prestored would of course take up more space.

 

 

 

So basically it's their way of caching.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.