Go Back   vb.org Archive > Community Central > vBulletin.org Site Feedback
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #21  
Old 11-18-2005, 07:19 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Michelle
And how do you define a badly written query?
A query that has to do a table scan of records rather then use indexed lookups.
Reply With Quote
  #22  
Old 11-18-2005, 07:22 PM
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Location: Greece
Posts: 1,856
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by noppid
A query that has to do a table scan of records rather then use indexed lookups.
Hmm I'm not sure what you mean (I'm new to all this) but using indexed lookups is not always possible I think!
Reply With Quote
  #23  
Old 11-18-2005, 07:31 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Michelle
Hmm I'm not sure what you mean (I'm new to all this) but using indexed lookups is not always possible I think!
You should design your tables in advance to accomodate using indexes. On small tables you can cheat. On large tables you can get in trouble. (50Kplus records)
Reply With Quote
  #24  
Old 11-18-2005, 08:04 PM
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Location: Greece
Posts: 1,856
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by noppid
You should design your tables in advance to accomodate using indexes. On small tables you can cheat. On large tables you can get in trouble. (50Kplus records)
I don't understand
Can you please take a look at my referrer statistics hack and tell me what do you think about the queries? :nervous:
Please? :nervous:
Reply With Quote
  #25  
Old 11-18-2005, 08:33 PM
Wayne Luke's Avatar
Wayne Luke Wayne Luke is offline
Senior Member
 
Join Date: Jan 2002
Location: Southern California
Posts: 1,694
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Michelle
I don't understand
Can you please take a look at my referrer statistics hack and tell me what do you think about the queries? :nervous:
Please? :nervous:
You should recommend placing an index on referrerid for your queries to work better and not result in table scans.
Code:
ALTER  TABLE  `user`  ADD  INDEX (  `referrerid`  )
As the user table is actually very rarely updated, at least compared to other tables, the additional index will decrease the overhead of your hack and not increase the creation or editing times of users substantially.

Read this article for more information:
http://www.databasejournal.com/featu...0897_1382791_2

Even though your hack only has two queries, it completes two table scans. Table Scans are bad because it copies the entire table into memory and locks it until completed. This means no one's records can be updated or created while it is locked. On a small forum this may take milliseconds as MySQL looks at every record to see if it matches. On large forums it can take several seconds.
Reply With Quote
  #26  
Old 11-18-2005, 11:18 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Most poeple have little idea how sql works, and how useful indexes are, that is why they are obsessed with hacks running "queries". A few simple reads on a well indexed table can take less than 100th of a second to run. Lots of people add fields to tables, but never think about indexes.

Back to the topic, A tick box for Runs/Adds queries is IMO pointless, anything except the most simple of hacks will almost certainly run at least one query. I would not waste my time filling it in.
Reply With Quote
  #27  
Old 06-10-2007, 01:43 PM
Alfa1's Avatar
Alfa1 Alfa1 is offline
 
Join Date: Dec 2005
Location: Netherlands
Posts: 3,537
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Would there be another way of defining sever load for a mod? It would be good to know this before installing a hack. Maybe the number of queries or maybe there is another approach?
Myself I like a lot of hacks on vb.org, but installing to many may cause problems I suspect. I would appreciate your view in this.
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 08:51 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.04634 seconds
  • Memory Usage 2,229KB
  • 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
  • (1)bbcode_code
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete