View Single Post
Old 03-04-2009, 08:45 PM  
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