Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-24-2008, 11:54 AM
IrPr IrPr is offline
 
Join Date: Mar 2005
Posts: 351
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Database Design

As im not such expert as well as you guys are, I've to ask some basic database designin quetions
I've to design a database for artists details, such as Biography
but just 10% of all my records have Biography data on that
there are 2 methods to me for design this table and its scripts:
  1. create one table to keep all fields on that, NULL MEDIUMTEXT field for biography
    in this case my table will store one field that just used for 10% of records
  2. create 2 tables and use one to one relationship between artists and biography
    in this case ive to use more query or use JOIN for my code
Which one is more optimized?

Another question:
I've to store two links for my tracks, low quality and high quality
Which one is more optimized?
to use one field in tracks table and use a splitter for the urls or just using serialized data
or use another table to join and use keys property?

Thanks
Reply With Quote
  #2  
Old 01-24-2008, 08:43 PM
Eikinskjaldi's Avatar
Eikinskjaldi Eikinskjaldi is offline
 
Join Date: Feb 2006
Location: Hell, never looked better
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by IrPr View Post
As im not such expert as well as you guys are, I've to ask some basic database designin quetions
I've to design a database for artists details, such as Biography
but just 10% of all my records have Biography data on that
there are 2 methods to me for design this table and its scripts:

[create one table to keep all fields on that, NULL MEDIUMTEXT field for biography
in this case my table will store one field that just used for 10% of records
this is the correct method. Having sparse data in the system is not a problem.

Quote:
Another question:
I've to store two links for my tracks, low quality and high quality
Which one is more optimized?
to use one field in tracks table and use a splitter for the urls or just using serialized data
or use another table to join and use keys property?
Serialisation is always a last resort. Either do it programmatically or have two fields, one for each type.
Reply With Quote
  #3  
Old 01-24-2008, 09:49 PM
IrPr IrPr is offline
 
Join Date: Mar 2005
Posts: 351
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Got ya
I created my tables this way

Thanks m8

--------------- Added [DATE]1201278626[/DATE] at [TIME]1201278626[/TIME] ---------------

One another question about bitmask and bitwise in DB and queries
I've multiple status for each entry on the table, such as SHOWN or HIDDEN, PREMIUM or FREE, ...
i can add one field for each status, for example 3 TINYINT(1) or BOOL fields
[SQL]
SELECT * FROM table WHERE `x`=1 AND `y`=0 AND `z`=1
[/SQL]


another method in my mind is use one TINYINT filed for all cases
INSERT and SELECT rows using AND(&) bit operand
for example
[SQL]
SELECT * FROM table WHERE `status`&5
[/SQL]
where 1 stands for x, 2 for y and 4 for z

which one is better? is there any difference in performance?
Reply With Quote
  #4  
Old 01-29-2008, 07:07 PM
IrPr IrPr is offline
 
Join Date: Mar 2005
Posts: 351
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

my previous post had been auto merged
so accept my BUMP
Reply With Quote
  #5  
Old 01-29-2008, 10:52 PM
Eikinskjaldi's Avatar
Eikinskjaldi Eikinskjaldi is offline
 
Join Date: Feb 2006
Location: Hell, never looked better
Posts: 572
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Personally I am not a fan of bits because I find them and their code obfuscating. I aslo do not know which is quicker.

My suggestion is try it both ways and use explain and some test queries to see which is better.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:11 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03985 seconds
  • Memory Usage 2,198KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete