vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin.org Site Feedback (https://vborg.vbsupport.ru/forumdisplay.php?f=7)
-   -   Runs/Adds Queries (https://vborg.vbsupport.ru/showthread.php?t=98766)

noppid 11-18-2005 07:19 PM

Quote:

Originally Posted by Michelle
And how do you define a badly written query? :confused:

A query that has to do a table scan of records rather then use indexed lookups.

Lea Verou 11-18-2005 07:22 PM

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!

noppid 11-18-2005 07:31 PM

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)

Lea Verou 11-18-2005 08:04 PM

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:

Wayne Luke 11-18-2005 08:33 PM

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.

Paul M 11-18-2005 11:18 PM

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.

Alfa1 06-10-2007 01:43 PM

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.


All times are GMT. The time now is 03:52 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.01090 seconds
  • Memory Usage 1,729KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete