vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Big Board Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=172)
-   -   Querying posts table.. (https://vborg.vbsupport.ru/showthread.php?t=128489)

randominity 10-07-2006 12:30 PM

Querying posts table..
 
So my boards have ~1.3m posts now.. and when I try to do a query from my shell
SELECT * FROM vb3_post WHERE ipaddress LIKE 'blah%';

the result is:

1995 rows in set (4 min 8.30 sec)

The current load on the server is:
[nolimit@ded-lax-016 ~]$ uptime
06:27:52 up 19 days, 17:31, 3 users, load average: 11.14, 11.27, 8.91

Is this supposed to happen given the load? Or any idea of what could be wrong?

orban 10-07-2006 01:31 PM

You have to add an index to your post table

ALTER TABLE post ADD INDEX (ipaddress);

I think...

-----

In future:

log-slow-queries
log_queries_not_using_indexes
long-query-time = 1

Add this to your my.cnf and fix all queries that show up in your log.

(Do an EXPLAIN on them and add appropriate indices.)

randominity 10-07-2006 01:37 PM

thanks will try that.

orban 10-07-2006 01:38 PM

It is advised to close the forums while adding the index (best turn off your webserver) or you will get a ton of table locks.

rootnik 10-12-2006 11:22 PM

orban,

Once you create the index, do you have to change the way you write the query to see the difference in performance?

Thanks,

Corey

orban 10-12-2006 11:23 PM

No. To make sure the index gets used use "EXPLAIN SELECT..."


All times are GMT. The time now is 07:48 AM.

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.00948 seconds
  • Memory Usage 1,709KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete