vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Community Lounge (https://vborg.vbsupport.ru/forumdisplay.php?f=13)
-   -   How Big Is 1 Query? (https://vborg.vbsupport.ru/showthread.php?t=93849)

Brinnie 08-08-2005 06:35 AM

How Big Is 1 Query?
 
I noticed a lot of people make a big deal over queries and I'm wondering if I should be making a big deal too.

How much space/time/whatever does your average query load?

Erwin 08-08-2005 06:58 AM

A query basically means that your database has to be accessed in order to get data.

Too many queries or one badly written query could mean a slow down of your site due to an increased server load due to increased CPU usage and/or hard disk read/writes. It all depends on the query, the number of them and the size of the database/ table being accessed.

m0nde 08-08-2005 07:03 AM

Quote:

Originally Posted by Brinnie
I noticed a lot of people make a big deal over queries and I'm wondering if I should be making a big deal too.

How much space/time/whatever does your average query load?

It depends on what the query is. You can have ONE SQL query insert or lookup a number of different things. Also, as Erwin said, a badly written one will do, slowly and inefficiently, what a well written one would do fairly painlessly.

You'll notice, for instance that at the bottom of vBulletin.org's pages they've got something showing the load. This page tells me: Page generated in 0.16971 seconds with 15 queries. This tells me that the queries were fairly light and that the CPU this thing is running on is fairly good!

- Sid

Brinnie 08-08-2005 12:44 PM

Quote:

Originally Posted by m0nde
It depends on what the query is. You can have ONE SQL query insert or lookup a number of different things. Also, as Erwin said, a badly written one will do, slowly and inefficiently, what a well written one would do fairly painlessly.

Would you consider the Quick Reply box a poorly written query?

Brad 08-08-2005 01:05 PM

Quote:

Originally Posted by Brinnie
Would you consider the Quick Reply box a poorly written query?

The quick reply box is not a query. A query is a call to the database to retrive information from the database (be it stored on the hdd or in memory), that is written in SQL.

What is SQL?

Quote:

SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database. According to ANSI (American National Standards Institute), it is the standard language for relational database management systems. SQL statements are used to perform tasks such as update data on a database, or retrieve data from a database. Some common relational database management systems that use SQL are: Oracle, Sybase, Microsoft SQL Server, Access, Ingres, etc. Although most database systems use SQL, most of them also have their own additional proprietary extensions that are usually only used on their system. However, the standard SQL commands such as "Select", "Insert", "Update", "Delete", "Create", and "Drop" can be used to accomplish almost everything that one needs to do with a database.
There is no one thing that seperates poor SQL from proper SQL, like anything with coding it's something you learn over time.

Here is a good place to get started if you want to learn more about SQL: http://sqlcourse.com/intro.html

FleaBag 08-08-2005 07:00 PM

I'd often wondered the same thing actually, thanks for sharing guys. :)

vBintense 08-08-2005 07:05 PM

The big issue over quarys is due to multiple hacking.

Say you have 10 hacks on showthread, and all the hacks add 1 quary, then you risk slowing down your server. So when a quary can be removed, and data retrieved with out the quary then it is the best option.

It is not that 1 quary is bad, it is that they add up, and due to that everyone trys not to have any.

Brad 08-08-2005 07:22 PM

Quote:

Originally Posted by insane-topics
The big issue over quarys is due to multiple hacking.

Say you have 10 hacks on showthread, and all the hacks add 1 quary, then you risk slowing down your server. So when a quary can be removed, and data retrieved with out the quary then it is the best option.

It is not that 1 quary is bad, it is that they add up, and due to that everyone trys not to have any.

Nor does many queries mean higher load. 2 small queries could cause less load than one large one.

Again, it depends on how the SQL is written, and more importantly how the database itself is layed out plus many of factors.

It's all trail and error :)

vBintense 08-08-2005 07:32 PM

Yes, but I was explaining why alot try not to add any quarys ;)

If you look thru posts people always say can't you do this with out a quary? personally I do not mind one extra quary here and there if it is not massive. But if I was to release something I would use as few as possible :)

It is like file edits, one line of file edit hurts nothing, but it is so much more liked if can do it with out an edit.

Zachery 08-08-2005 07:44 PM

Quote:

Originally Posted by insane-topics
Yes, but I was explaining why alot try not to add any quarys ;)

If you look thru posts people always say can't you do this with out a quary? personally I do not mind one extra quary here and there if it is not massive. But if I was to release something I would use as few as possible :)

It is like file edits, one line of file edit hurts nothing, but it is so much more liked if can do it with out an edit.

less is not always best.

10 querys could be lighter than 5 querys

Its all about trial and error, some times querys are nessary, some times they arn't. Indies also help alot.

and its query ;) not quary


All times are GMT. The time now is 12:27 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.01333 seconds
  • Memory Usage 1,740KB
  • 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
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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