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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-17-2006, 11:56 PM
coolegg's Avatar
coolegg coolegg is offline
 
Join Date: Nov 2004
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default A question about queries to the TABLE_PREFIX.attachment table...

I recently noticed a problem on my vBAdvanced CMPS site (vB version 3.0.5) where the index page (the CMPS portal page) was loading very slowly sometimes. Using the debug mode I was able to zero the problem down to this query here which sometimes was taking 7+ seconds to execute:

SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "attachment where visible=0

That query is used by the CMPS moderator module, which I don't use, so I was able to address the immediate problem by disabling that module (I should have done so all along since I didn't use it), and I confirmed that my normal members weren't experiencing the problem anyway because the moderator module wasn't showing for them.

But in my troubleshooting of this problem I noticed that there are several other places in several of the vB scripts where the total number of thread attachments are counted exactly as the above query does (edit_post.php, newattachment.php, function_newpost.php and so on). So I am wonderring what the root cause of the slow query is, and if it is happening elsewhere in my site (I think it is because I have noticed that saving/editting posts is also slow. I will be doing more testing tonight).

So I guess my first question is this... 1. is it normal for that query to take that long?

My second question is this... 2. When using a query like "SELECT COUNT(*) AS count FROM..." where one of the fields in the table is a large blob/text field does the server actually load up all the data from the table including the large data fields? Would I be better off if the query was "SELECT COUNT(attachmentid) AS count FROM..." where attachmentid is the primary key, would that be faster or does it not matter?

And my third question is 3. I notice that the field in the attachment table that actually holds the attachment data, "filedata", is a mediumtext field; I am curious, why is it not a blob field? Is it because some attachments are text files?

My vB site is only 1 year old; has 27,000 members, it has 1,150 attachments uploaded so far; and I limit the size to 200,000 bytes right now. My site is not really a file sharing site, but as you can see they do like to share a few files (4 per day on average, sitewide). My concern is that over time this issue is just going to get worse. So far the problem seems to be limitted to this one query which counts attachments.

Thanks in advance for any help and information.
Reply With Quote
 


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:36 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.05695 seconds
  • Memory Usage 2,424KB
  • 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
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (1)postbit_attachment
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)showthread_list
  • (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_threadedmode.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_threaded
  • showthread_threaded_construct_link
  • 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
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete