Toom much queries for a blank template
Posted: 20 September 2007 05:31 AM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  375
Joined  10-20-2005

Hello, in order to reduce database high usage I’ve applied all the recommendations I’ve found here:

http://expressionengine.com/wiki/Reduce_Queries/

I’ve created an EE blank template to check if I’ve got only 4 queries as the wiki says, though it is using 9. I think some of them should not appear and I’d like somebody help me to avoid them. Here are some questions:

1. “Don’t run sessions. Use cookies only. (session preferences) “. I’m not using but I can see this query, is it OK?

UPDATE `exp_sessions` SET `session_id` = '7da328e3bc0192a1dss7bea3d92baf3a6d5e', `member_id` = '1', `admin_sess` = '1', `ip_address` = 'XX.XX.XXX.XXX', `user_agent` = 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; ca-es) Ap', `last_activity` = '112168' WHERE session_id ='7d66cdsasdbea32343d32af3a6d5e'

2. As the template is blank, why does EE search for global variables?

SELECT variable_name, variable_data FROM exp_global_variables WHERE site_id = '1' AND user_blog_id = '0'

Thank you.

Profile
 
 
Posted: 20 September 2007 06:08 AM   [ Ignore ]   [ # 1 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1097
Joined  03-22-2006

Now, I’m just guessing here, but how would you check to see if global variables have been used without first knowing what global variables are available?

Ok I do understand your point about the template being completely blank, but in a real world scenario when are you going to be serving blank templates?

I guess to save on memory, EE could first just grab the variable_name values rather than the complete data set but doing so will then require 2 queries. Personally I wouldn’t worry too much about that simple select statement.

 Signature 

(a.k.a the_butcher)

Profile
 
 
Posted: 20 September 2007 07:24 AM   [ Ignore ]   [ # 2 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23538
Joined  05-20-2002

Like the_butcher says, I’m not sure how you could realistically avoid checking for globals.  And it isn’t much of a query, so I can’t see hacking it out if you knew you’d never use globals.  (Also keep in mind- I’m not dead sure it can be reduced to 4 queries on 1.6.  So that may/may not be a factor.)

As for the session bit- I do be it might be ditchable.  Are you using cookies only for both frontend and backend?

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 20 September 2007 08:21 AM   [ Ignore ]   [ # 3 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  375
Joined  10-20-2005

I know it’s a simple statement, but when you’ve got half million daily pageviews the database hangs the server and every little improvement will be productive.

Robbie, do you mean Control Panel Session Type and User Session Type? Both use only cookies.

Profile
 
 
Posted: 20 September 2007 09:51 AM   [ Ignore ]   [ # 4 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23538
Joined  05-20-2002

On the globals?  Only thing I can think is to request a user configurable to turn it off.  Or a hack.  The sessions check- I’ll have to ask the crew if it’s required or not.  But if you’re using cookies on both and have disabled the stats?  I’m not sure why it’s required.  Might be, but I can’t tell for sure.

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 21 September 2007 01:56 AM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  375
Joined  10-20-2005

Yes, I diableb sessions on both and the stats are disabled.

Profile
 
 
Posted: 21 September 2007 10:32 AM   [ Ignore ]   [ # 6 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32911
Joined  05-14-2004

I can’t help but think that if a blank page is not loading instantly, you have a server infrastructure issue.  Have you discussed your speed problems with your host? Perhaps your hosting plans needs to go up a notch to handle your traffic?

 Signature 
Profile
MSG
 
 
Posted: 24 September 2007 04:23 AM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  375
Joined  10-20-2005

I don’t see problems with speed. The only problem is that ee queries collapse the db and hangs the server. I can’t say now it’s features but it’s a good server. We acquired it this august.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65027 Total Logged-in Users: 22
Total Topics: 82117 Total Anonymous Users: 14
Total Replies: 441316 Total Guests: 192
Total Posts: 523433    
Members ( View Memberlist )