Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 01-15-2002, 03:32 PM
Guru Guru is offline
 
Join Date: Nov 2001
Location: Pacific Northwet
Posts: 50
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've noticed in several hacks that it is common to modify the user table to add fields. This table already has a fairly large number of fields, and adding several hacks that increase this number just makes those queries that much longer.

Another approach is to create a separate table, and use a JOIN SQL query to get the data, yet that seems to be seldom used. Is there a reason that hacks don't add a new table rather than modifying the user table?

---

As an example, consider the common hack of making a user contribution table. The hacks here add donate fields. (I'd like to see an amount, a date, and a field indicating whether the user wishes to remain anonymous.) This modification of the user table adds the donate overhead for every user.

The second approach would be to add a new donation table with a few fields. The userid would be the primary key. If only 5% of your users are contributors, your donation table would be much, much smaller. And, the hack wouldn't affect the user table at all. This should be a safer way to hack vB, shouldn't it?

Are there performance considerations, or is it just simpler to add a few fields to the user table?
Reply With Quote
  #2  
Old 01-15-2002, 03:58 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I usually use the options field in the user table. I only use it privately tho, because if I start using it in hacks, I guess at least one more person will start using that technique (not that I mind, of course ). The problem would be, that two hacks and more will surely use the same flag (16, 32, 64, etc.) so that technique would become useless.

Using another table is a bit clumsy IMO, because then you won't be able to access the value without selecting it directly from the database (as opposed to using getuserinfo() and that's it), unless you modify the getuserinfo() function to do that JOIN.
Reply With Quote
  #3  
Old 01-15-2002, 04:14 PM
damule damule is offline
 
Join Date: Dec 2001
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It is a way of doing it there may be a couple reasons it may not be commonly done

1 When an author crates a hack they try to keep installation as simple as possible, most of the people who make there’s hacks have a very limited understanding of VBB as a whole so it takes a lot of trial and error just to get their hack to work.

2 There is a big performance hit on the DB server.

When you do a SELECT on a table with 100 records, the server looks at 100 records. Now if you do a join with the same table with 100 records and another table with 10 records the DB server uses the data from record 1 on are small table and try’s to make a match with the records on the big table, so we’ve made the server look at 100 record so far and it does the same with the second record so we’re upto 200 records that we’ve made the server look at and now with the rest we come to a total of 1000 record views.

Hope that explains it, joins are never and easy subject.
Reply With Quote
  #4  
Old 01-15-2002, 04:23 PM
Guru Guru is offline
 
Join Date: Nov 2001
Location: Pacific Northwet
Posts: 50
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by FireFly
Using another table is a bit clumsy IMO, because then you won't be able to access the value without selecting it directly from the database (as opposed to using getuserinfo() and that's it), unless you modify the getuserinfo() function to do that JOIN.
That makes sense for the example I posted, especially if you want a special graphic next to the user name every time it is referenced.
Reply With Quote
  #5  
Old 01-15-2002, 04:42 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Guru
That makes sense for the example I posted, especially if you want a special graphic next to the user name every time it is referenced.
Yup, that's my point.
Reply With Quote
Reply

Thread Tools
Display Modes

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 04:21 AM.


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.04531 seconds
  • Memory Usage 2,195KB
  • 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_postinfo_query
  • fetch_postinfo
  • 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