 | |  | |
November 2nd, 2012, 09:30 PM
|
#1 (permalink)
| | Member Verified Customer
Join Date: May 2003
Posts: 218
| Slow Queries
Chuck;
Probably to do with the size of the gallery but I am going to attach some slow queries and see if you think there is a way to impove them. Like do I need to an an index and which one if you think that would help. Not speaking about the pp query itself, just my site. Quote:
# Time: 121102 22:26:26
# User@Host: members_prime[members_prime] @ localhost []
# Query_time: 2.110317 Lock_time: 0.000014 Rows_sent: 1 Rows_examined: 518043
use members_prime;
SET timestamp=1351909586;
SELECT exifinfo FROM pp_exif WHERE photoid=17868;
| Quote:
# Time: 121102 22:26:35
# User@Host: members_prime[members_prime] @ localhost []
# Query_time: 0.737828 Lock_time: 0.000026 Rows_sent: 37 Rows_examined: 815832
SET timestamp=1351909595;
SELECT id,user,userid,cat,storecat,title,ismature,bigimage,height,width FROM pp_photos WHERE approved=1 AND storecat=0 ORDER BY date DESC LIMIT 37;
| Quote:
# Time: 121102 22:26:37
# User@Host: members_prime[members_prime] @ localhost []
# Query_time: 2.002131 Lock_time: 0.000098 Rows_sent: 37 Rows_examined: 1631611
SET timestamp=1351909597;
SELECT id,user,userid,cat,storecat,title,ismature,bigimage,height,width, id*0+RAND() as rand_col FROM pp_photos WHERE approved=1 ORDER BY rand_col DESC LIMIT 37;
| Quote:
# Time: 121102 22:27:17
# User@Host: members_prime[members_prime] @ localhost []
# Query_time: 2.016908 Lock_time: 0.000053 Rows_sent: 1 Rows_examined: 518043
SET timestamp=1351909637;
SELECT exifinfo FROM pp_exif WHERE photoid=774451;
| Quote:
# Time: 121102 22:37:03
# User@Host: members_prime[members_prime] @ localhost []
# Query_time: 0.800466 Lock_time: 0.000041 Rows_sent: 52619 Rows_examined: 105238
SET timestamp=1351910223;
SELECT id,user,userid,cat,storecat,date,title,description,ismature,keywords,bigimage,width,height,filesize,views,medwidth,medheight,medsize,approved,rating,votes,allowprint,numcom,lastposter FROM pp_photos WHERE cat=716 AND approved < 2 ORDER BY disporder,lastpost DESC;
|
Last edited by trackpads; November 3rd, 2012 at 10:56 AM.
Reason: removed the last query, it was from vb not pp
|
| |
November 2nd, 2012, 09:31 PM
|
#2 (permalink)
| | Member Verified Customer
Join Date: May 2003
Posts: 218
|
Thanks again btw, its appreciated.
|
| |
November 2nd, 2012, 09:39 PM
|
#3 (permalink)
| | Member Verified Customer
Join Date: May 2003
Posts: 218
|
Merged into post above
|
| |
November 3rd, 2012, 06:35 AM
|
#4 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,653
|
I will look and see if there is anything to comment on but yes you are probally right about it being a size issue. Like alot of the ones I glanced over your only grabbing one specific field entry or 37 entries so it is not like your scanning an entire table.
|
| |
November 3rd, 2012, 10:56 AM
|
#5 (permalink)
| | Member Verified Customer
Join Date: May 2003
Posts: 218
|
Right but what does 'Rows_examined: 1631611' mean?
Can I add an index maybe to help it? I am sure the query is fine, just hoping I can find a work around.
|
| |
November 3rd, 2012, 12:50 PM
|
#6 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,653
|
There is no way to an some index as there are already the proper indexes.
The only other suggestion is try setting ROWS EXAMINED statement for certain things.
First say in showphoto.php for the exif info line 575 you could add say maybe the code in bold but test it Code: Content visible to verified customers only.
Then in pp-inc.php for your display_gallery function these statements add the code in bold Code: Content visible to verified customers only.
You can test that everything works fine and see the speed difference
|
| |
November 3rd, 2012, 03:11 PM
|
#7 (permalink)
| | Member Verified Customer
Join Date: May 2003
Posts: 218
|
ok, let me try it
|
| |
November 3rd, 2012, 03:13 PM
|
#8 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,653
|
Not a problem let me know
|
| |
November 4th, 2012, 01:48 PM
|
#9 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,653
|
Did you ever see if those queries we changed dissappeared from the slow queries log?
|
| |
November 8th, 2012, 09:45 PM
|
#10 (permalink)
| | Member Verified Customer
Join Date: May 2003
Posts: 218
|
I tried the first edit but got this:
Warning: Variable passed to each() is not an array or object in [path]/gallery/showphoto.php on line 596
And the second game me this: Parse error: syntax error, unexpected T_STRING in /home/members/public_html/gallery/pp-inc.php on line 1253
Could you post the files or pm me so I can upload them? I cant screw it up that way |
| |
November 9th, 2012, 07:59 AM
|
#11 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,653
|
This was just a suggestion not something I am applying to our code. You use at your own risk for reading on your thing see the internet MySQL :: Rows Examined, why so many?
There is no error in our code or anything for us to fix. The example I posted might have been from an older post that may not be valid in later mysql
Last edited by Chuck S; November 9th, 2012 at 08:11 AM.
|
| |
November 9th, 2012, 08:24 AM
|
#12 (permalink)
| | Member Verified Customer
Join Date: May 2003
Posts: 218
| Quote:
Originally Posted by Chuck S There is no error in our code or anything for us to fix. | Chuck, got it, didn't say otherwise. Are you not a morning person man?
thanks again,
-Jason
|
| |
November 9th, 2012, 08:33 AM
|
#13 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,653
|
Nope just saying this was all just suggestions to try
|
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Rate This Thread | Linear Mode | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | |
Similar Threads | | Thread | Thread Starter | Forum | Replies | Last Post | | Couple of queries | martyn83 | Photopost Pro How Do I...? | 59 | October 4th, 2011 05:48 PM | | Slow Queries | rsj1 | Photopost Pro Bug Reports | 7 | March 5th, 2010 05:42 AM | | Big Queries | DST Daddy | Photopost Pro How Do I...? | 7 | January 9th, 2007 10:29 PM | | Slow queries - what causes them | dontom | Photopost Pro Bug Reports | 11 | November 9th, 2006 10:43 PM | | queries | BrandiDup | Before You Buy | 4 | February 25th, 2006 03:16 PM | All times are GMT -5. The time now is 04:09 PM. | |