Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 03-04-2009, 06:25 PM   #1
teh ghey
Guest
 
Posts: n/a
Any SQL pros here? question for you...

The content management system im using for my site is creating temp tables and copying them to disk with every query its slowing down my site.

So I only have 100 users on my site but my site is fucking sloow.
How SHOULD queries be made? Should it be doing this in memory?

Is it hard to switch this from copying things to disk to copying them to memory?
Im going to complain to them but want a better idea of what Im talking about first.
thanks
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-04-2009, 06:38 PM   #2
drocd
Confirmed User
 
Join Date: Aug 2007
Posts: 128
There could be numerous related reasons why this is happening. Your mysql settings may need to be tuned, queries optimized, tables indexed, etc.
__________________
230-699
drocd is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-04-2009, 06:40 PM   #3
teh ghey
Guest
 
Posts: n/a
thanks. but if its creating temp tables and copying them to disk then thats bad, right?
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-04-2009, 06:50 PM   #4
drocd
Confirmed User
 
Join Date: Aug 2007
Posts: 128
Yes. Ideally you'd want mysql to write the table to memory instead of disk. In some cases mysql is forced to write to disk though. You can try increasing mysql variables max_heap_table_size and tmp_table_size. You could also find the specific queries and do an EXPLAIN on them to find out what's really going on and find a solution.
__________________
230-699
drocd is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-04-2009, 06:52 PM   #5
tical
Confirmed User
 
Join Date: Feb 2002
Location: Las Vegas
Posts: 6,504
why are you creating temp tables with every query? seems like something that would be done at the end of the day or something to handle cumulative amounts of data (vs every query)
tical is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-04-2009, 07:27 PM   #6
NextBigTube
Confirmed User
 
Join Date: Oct 2008
Posts: 352
Quote:
Originally Posted by teh ghey View Post
The content management system im using for my site is creating temp tables and copying them to disk with every query its slowing down my site.

So I only have 100 users on my site but my site is fucking sloow.
How SHOULD queries be made? Should it be doing this in memory?

Is it hard to switch this from copying things to disk to copying them to memory?
Im going to complain to them but want a better idea of what Im talking about first.
thanks
I am confused by your statement "creating temp tables and copying them to disk". Temp tables are created explicitly. In Sybase it is "CREATE #tablename", in MySQL, it appears to be "CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name"

If your CMS is running queries (rather an SQL script) that creates a temp table, then there must be a good reason (or bad programming). e.g. A lot of times temp tables are created when it is necessary to iterate the rows.

Can post the queries to provide a better understanding of the issue ?
__________________

Porn Tubes Hawt Tube,Next Big Tube,
Gay Tube Tube 4 Gay
Amazon.com Discount Finder

Last edited by NextBigTube; 03-04-2009 at 07:28 PM..
NextBigTube is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-04-2009, 07:42 PM   #7
react
Confirmed User
 
Industry Role:
Join Date: Sep 2003
Location: NZ
Posts: 673
Your database has a fear of commitment.
__________________
--
react
react is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-04-2009, 08:19 PM   #8
sysk
Confirmed User
 
sysk's Avatar
 
Industry Role:
Join Date: Aug 2007
Location: Montreal
Posts: 1,005
Quote:
Originally Posted by react View Post
Your database has a fear of commitment.
I lol'd
__________________
icq: 612510168 / email: [email protected] / php ninja 4 hire
sysk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-04-2009, 08:32 PM   #9
teh ghey
Guest
 
Posts: n/a
Quote:
Originally Posted by tical View Post
why are you creating temp tables with every query? seems like something that would be done at the end of the day or something to handle cumulative amounts of data (vs every query)
its a dating site, so theres tons of queries every minute
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-04-2009, 08:33 PM   #10
teh ghey
Guest
 
Posts: n/a
Quote:
Originally Posted by NextBigTube View Post

Can post the queries to provide a better understanding of the issue ?
Here are a couple of them:

| 1138108 | (my-db-username-hidden) | localhost |(my-db-name-hidden) | Query | 0 | Copying to tmp table | SELECT m.* , data_age, data_height, data_weight, data_sexually, data_seekingage_from, data_seekingag |

| 1138109 | (my-db-username-hidden)| localhost | (my-db-name-hidden) | Query | 0 | Copying to tmp table | SELECT m.* , data_age, data_height, data_weight, data_sexually, data_seekingage_from, data_seekingag |


Unfortunately the mysql processlist doesn't show the entire query to provide for you.
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-04-2009, 08:45 PM   #11
smack
Push Porn Like Weight.
 
smack's Avatar
 
Industry Role:
Join Date: Mar 2002
Location: Inside .NET
Posts: 10,652
Quote:
Originally Posted by teh ghey View Post
thanks. but if its creating temp tables and copying them to disk then thats bad, right?
it's not necessarily a bad thing. it depends on how you will be using the tables and what they're building off of. it's most certainly not optimal if it's slowing down your site that much.

i would have to look at the joins to really tell you for certain, but a couple months ago i ran in to a similar problem with building temporary tables. the query was taking 30 - 45 seconds to build, so what i ended up doing was creating a stored procedure with a dynamic sql statement in it, then exchanging one of my tables for a normalized look up table index off of integer values. that ended up taking it from 30 - 45 seconds average down to milliseconds.

it's all about normalization, good indexing, and smart joins.
__________________
Cry havoc and let slip the dogs of war.
smack is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-04-2009, 08:57 PM   #12
drocd
Confirmed User
 
Join Date: Aug 2007
Posts: 128
Have your host/server admin/whoever enable the mysql slow query log. Then you will have a full list of mysql queries that you can work on optimizing.

The answers you need are in this thread.

PS; tical and NextBigTube clearly don't understand your problem, so please ignore their posts.
__________________
230-699

Last edited by drocd; 03-04-2009 at 08:59 PM..
drocd is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-04-2009, 10:15 PM   #13
teh ghey
Guest
 
Posts: n/a
oops mispost

Last edited by teh ghey; 03-04-2009 at 10:16 PM..
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-04-2009, 11:29 PM   #14
ExLust
Confirmed User
 
ExLust's Avatar
 
Join Date: Aug 2008
Posts: 3,223
Technically challenging.
__________________

BE A PARTNER
ExLust is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-05-2009, 01:08 AM   #15
quantum-x
Confirmed User
 
quantum-x's Avatar
 
Join Date: Feb 2002
Location: ICQ: 251425 Fr/Au/Ca
Posts: 6,863
From the looks of the query log, you need to index some of those tables a little better.
If those select queries are using the filesystem, it's probably because of a lack of index.

You need to run an EXPLAIN query.

Put "EXPLAIN" in front of one of the lagging queries, ie:

EXPLAIN SELECT m.* , data_age, data_height, data_weight, data_sexually, data_seekingage_from, data_seekingag..........

This will break down the joins, subqueries, etc, and will show you exactly which relationship / index is using the file system. From there, make sure it's indexed, and you'll probably be ok.

If not, you'll need to rewrite the query a little more efficiently.
quantum-x is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-05-2009, 04:52 AM   #16
Varius
Confirmed User
 
Industry Role:
Join Date: Jun 2004
Location: New York, NY
Posts: 6,890
Quote:
Originally Posted by teh ghey View Post
Here are a couple of them:

| 1138108 | (my-db-username-hidden) | localhost |(my-db-name-hidden) | Query | 0 | Copying to tmp table | SELECT m.* , data_age, data_height, data_weight, data_sexually, data_seekingage_from, data_seekingag |

| 1138109 | (my-db-username-hidden)| localhost | (my-db-name-hidden) | Query | 0 | Copying to tmp table | SELECT m.* , data_age, data_height, data_weight, data_sexually, data_seekingage_from, data_seekingag |


Unfortunately the mysql processlist doesn't show the entire query to provide for you.
Yes it does:

show full processlist;
__________________
Skype variuscr - Email varius AT gmail
Varius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-05-2009, 05:36 AM   #17
Antonio
Too lazy to set a custom title
 
Antonio's Avatar
 
Join Date: Oct 2001
Location: Spartaaaaaaaaa
Posts: 14,136
Quote:
Originally Posted by react View Post
Your database has a fear of commitment.
Antonio is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.