Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Linux, Apache, MySQL > MySQL Help

MySQL Help Post any question relating to MySQL here and hopefully someone can help

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2006-11-29, 09:30 PM
Senior Member
 
Join Date: Jul 2006
Location: Prague, Czech Republic
Posts: 193
vladimir_cz is on a distinguished road
Send a message via ICQ to vladimir_cz Send a message via MSN to vladimir_cz Send a message via Yahoo to vladimir_cz Send a message via Skype™ to vladimir_cz
Default slow mysql "sending data" stage between mysql and php

Hi!

I have problem:
I have IPB forum installed. After search in IPB (search takes about 3-4
seconds for post table about 300 000 records, ~250mb data) mysql shows "Sending
Data"
status and takes about 3-5 minutes.

I tested with PHP 5.2, PHP 4.4, PHP 4.2.3 - with same results.
I switched from MySQL 4.2.18 to 4.2.21 and 4.2.22 with same result.

I tested with apache module, fastCGI with NGINX web server - same
results.

I tested mysql connections with socket and network connection.

May be I missed some variables from php.ini?
May be I missed some variables from my.cnf?
Main question - how I can speedup code for accept "Sending data" stage
between PHP and MySQL more fast?
__________________
Thank you. Vladimir, Czech Republic.
http://www.smartwebco.com/
I'm looking for job.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 2006-11-30, 12:08 PM
stuart's Avatar
Administrator
 
Join Date: Jan 2003
Location: Scotland
Posts: 472
stuart will become famous soon enoughstuart will become famous soon enough
Send a message via MSN to stuart
Default

To be honest, I do not know what the '"Sending Data" stage is.... but here are a couple of things to check.
There are various setting in mysql which may need tweeking... some of these include: query_cache_size, table_cache, tmp_table_size... and many others.
Also check your indexes.

But again, this is only a guess as I have no idea what 'Sending Data' is really doing.
Reply With Quote
  #3 (permalink)  
Old 2006-11-30, 12:30 PM
Senior Member
 
Join Date: Jul 2006
Location: Prague, Czech Republic
Posts: 193
vladimir_cz is on a distinguished road
Send a message via ICQ to vladimir_cz Send a message via MSN to vladimir_cz Send a message via Yahoo to vladimir_cz Send a message via Skype™ to vladimir_cz
Default

just for clarification - I installed latest mySQL 5 and check it without PHP (with console client). same results.
main problem - there is "IN" with a lot of ids inside.
I have no idea how I can make it faster (only by two steps with creation temporary table)
__________________
Thank you. Vladimir, Czech Republic.
http://www.smartwebco.com/
I'm looking for job.
Reply With Quote
  #4 (permalink)  
Old 2006-11-30, 09:48 PM
Xnuiem's Avatar
Senior Member
 
Join Date: May 2004
Location: DFW, Texas
Posts: 1,104
Xnuiem will become famous soon enough
Send a message via Yahoo to Xnuiem
Default

using a bunch of OR statements is actually faster than IN.

Also, is the field indexed properly?

What does the SQL statement look like?
__________________
I rarely give code examples.
No, I have never used IIS or Windows of any kind as a web server. Get a real OS!
Please don't PM me, I won't respond.
Reply With Quote
  #5 (permalink)  
Old 2006-12-01, 04:22 AM
Senior Member
 
Join Date: Jul 2006
Location: Prague, Czech Republic
Posts: 193
vladimir_cz is on a distinguished road
Send a message via ICQ to vladimir_cz Send a message via MSN to vladimir_cz Send a message via Yahoo to vladimir_cz Send a message via Skype™ to vladimir_cz
Default

SELECT distinct(p.pid), p.queued, t.approved, t.forum_id
FROM fgrposts p LEFT JOIN fgrtopics t on (t.tid=p.topic_id)
WHERE
t.forum_id IN (78,73,74,75,76,63,64,65,57,36,45,59,46,32,41,33,3 1,34,35,40,48,60,68,49,37,38,39,47,50,42,67,43,66)
AND p.queued=0 AND ( LOWER(p.post) LIKE '%girl%' )


there is explain for select:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t ALL PRIMARY,forum_id,last_post NULL NULL NULL 13668 Using where; Using temporary
1 SIMPLE p ref 5last,topic_id,queued 5last 4 gdv_ru.t.tid 24 Using where
__________________
Thank you. Vladimir, Czech Republic.
http://www.smartwebco.com/
I'm looking for job.
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.5 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.5 (a popular PHP IDE) and NuCoder 2.0 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 11:28 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.