views:

25

answers:

2

I'm designing a MySQL table for an authentication system for a high-traffic personal website. Every time a user comment, article, etc is displayed the following fields will be needed:

  • login
  • User Display
  • User Bio ( A little signature )
  • Website Account
  • YouTube Account
  • Twitter Account
  • Facebook Account
  • Lastfm Account

So everything is in one table to prevent the need to call sub-tables. So my question is:

¿Would there be any improvements if I combine Website, Youtube, Twitter, Facebook and Lastfm columns to one?

For example:

[website::something.com][youtube::youtube.com/something]

A: 

No, combining these columns would not result in any improvement. Indeed it seems you would extend the overall length (with the adding of prefix and separators, hence potentially worsening performance.

A few other tricks however, may help:

  • reduce the size of the values stored in "xxxAccount" columns, by removing altogether, or replacing with short-hand codes, the most common parts of these values (the examples shown indicate some kind of URL whereby the beginning will likely be repeated.
  • depending on the average length of the bio, and typical text found therein, it may also be useful to find ways of shrinking its [storage] size, with simple replacement of common words, or possibly with actual compression (ZIP and such), although doing so may result in having to store the column in a BLOB column which may then become separated from the table, depending on the server implementation/configuration.

And, of course, independently form any improvements at the level of the database, the use model indicated seems to prompt for caching this kind of data agressively, to avoid the trick to SQL altogether.

mjv
*waiting for the tricks* :)
kuroir
A: 

Well i dont think so , think of it this way .. you will need some way to split them and that would require additional processing and then why not just have one field in the whole table and have everything in that? :) Dont worry about the performance it would be better with separate columns

Sabeen Malik