Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 04-03-2011, 07:03 PM
squishi squishi is offline
 
Join Date: May 2006
Location: Frankfurt
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Custom Profile Fields and Performance

For an extension that I am creating, I have added many custom profile fields.
The vb_userfield now has 71 fields. About half of those fields belong to my extension.

These extra fields are only necessary in my extension. I guess they are loaded in other parts of the forum as well, where they are actually not needed.
I could remove the extra fields and add them to a special database. The downside is that I would have to do all the validation in my script.

From a performance stand point, should I remove the custom profile fields?
Should one keep the field count as low as possible?
Reply With Quote
  #2  
Old 04-03-2011, 07:14 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are you sure they are getting loaded in other parts of the forum all the time? I'd go into debug mode on your test site and look at the queries and see when the other fields are actually getting loaded. Perhaps it would be easier to modify those queries in the code rather than create your own table to hold them and have to do all the validating.
Reply With Quote
  #3  
Old 04-03-2011, 07:21 PM
squishi squishi is offline
 
Join Date: May 2006
Location: Frankfurt
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's userfields... I would think they get loaded for example in the postbit for each user.

About the debug mode... I was notified that members of my site can see the debug output. Is that the default behavior of vbulletin's debug mode? Why was the debug output not wrapped with a admin permission check?
Is there a possibility for me to wrap the debug output with a conditional?
Reply With Quote
  #4  
Old 04-03-2011, 07:42 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, that is the default for debug mode. It's a tool to use on your test site where you actually write your code. I leave it on all the time on my test sites.

You can wrap it in a condition if you need it on your main site:
PHP Code:
if ($_SERVER["REMOTE_ADDR"] == "xx.xx.xx.xx") {
    
// enable debug mode for only the IP xx.xx.xx.xx
    
$config['Misc']['debug'] = true;

Reply With Quote
  #5  
Old 04-03-2011, 08:18 PM
squishi squishi is offline
 
Join Date: May 2006
Location: Frankfurt
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's a good idea and has helped me find some uncached templates.


In debug mode, I see that all userfields are queried twice on a showthread page.

Once for the user who is browsing the page:
Code:
SELECT 
	userfield.*, usertextfield.*, user.*, UNIX_TIMESTAMP(passworddate) AS passworddate, user.languageid AS saved_languageid,
...
FROM vb_user AS user
LEFT JOIN vb_userfield AS userfield ON (user.userid = userfield.userid)
...
WHERE user.userid = 1
And as I suspected, they get queried for each individual post as well:
Code:
SELECT
	post.*, post.username AS postusername, post.ipaddress AS ip, IF(post.visible = 2, 1, 0) AS isdeleted,
	user.*, userfield.*, usertextfield.*,
...
FROM vb_post AS post
LEFT JOIN vb_user AS user ON(user.userid = post.userid)
...
WHERE post.postid IN (0,167,264360)
...
I am not planning on upgrading my forum anymore. So edit of the source code are not a problem for me.

So you would rather edit those queries instead of creating a new database table for the fields?
Reply With Quote
  #6  
Old 04-03-2011, 09:51 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Me? I don't know which I would do since I have no idea what your profilefields do or where you need them.
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 06:57 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07419 seconds
  • Memory Usage 2,205KB
  • 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_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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