![]() |
Profiler says 64 Queries being run. is that too high? should i be worried? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Profiler says 64 Queries being run. is that too high? should i be worried? (/showthread.php?tid=12557) Pages:
1
2
|
Profiler says 64 Queries being run. is that too high? should i be worried? - El Forum - 10-23-2008 [eluser]Latavish[/eluser] Hi guys, I am working on what i think is a very nice CMS video/picture site using codeigniter. And I'm also using CI Profiler as well as I code. I just have a simple question. My project is about 85% complete and i'm sure when its all said and done I will need to go back and tweek a few things to make it run faster and more efficient. But I noticed that on a users profile page that I have designed i has the following information. MEMORY USAGE 2,130,392 bytes BENCHMARKS Loading Time Base Classes 0.0393 Controller Execution Time ( Showcase / Index ) 0.1272 Total Execution Time 0.1668 QUERIES (64) ...................... I'm not sure if this is okay or not or if I should be worried, but for nice sized CMS system would running 64 Queries be okay or is that "natural". I know when i start my tweeking process, im sure I can find a way to cut that down. But I guess i'm just getting worried that when I finish my project and place it online for beta testing that when the user base grows, I dont want it to strain my server too much. OR am I just being a little paranoid? Latavish Profiler says 64 Queries being run. is that too high? should i be worried? - El Forum - 10-23-2008 [eluser]Xeoncross[/eluser] Most CMS/blog systems run between 18-32 queries. 64 seems a bit much - I am sure there are queries in there that could be deleted or merged to save time. Do you use JOIN's at all? - they save server time if you do them right. Also, don't trust time very much as it depends on the speed of your server - trust RAM usage more as it will mostly stay the same. If you're pages take 6Mb to load (or 8MB like wordpress) then you're site will die if you are digg. (wow that last word sounds bad) Profiler says 64 Queries being run. is that too high? should i be worried? - El Forum - 10-23-2008 [eluser]Latavish[/eluser] at the moment I have very few joins setup but I know I will go back and add more when the project is completed or when i get to my tweeking phase. I'm just a little scared of the whole join process as it sometimes confuesses the heck out of me. lol Also i'm only noticing this one my users profile page. All my other pages uses 6-15 queries. I have been putting it off but i'm guessing this is the time to master the whole "left join" thing. Profiler says 64 Queries being run. is that too high? should i be worried? - El Forum - 10-23-2008 [eluser]Xeoncross[/eluser] [quote author="Latavish" date="1224792013"]I have been putting it off but i'm guessing this is the time to master the whole "left join" thing.[/quote] lol, I know what you mean - I put it off until I started working on CXPDO and had to deal with left joins. If you download that package and set the $return value to true - you can see how LEFT, INNER, and RIGHT queries are formed. i.e. Code: <?php You don't need to actually use the package - but it will show you how to make valid MySQL and/or SQLite JOIN queries. Profiler says 64 Queries being run. is that too high? should i be worried? - El Forum - 10-23-2008 [eluser]sl3dg3hamm3r[/eluser] huh? maybe i missed something, but what's wrong with Code: $this->db->join(); ? Profiler says 64 Queries being run. is that too high? should i be worried? - El Forum - 10-23-2008 [eluser]Xeoncross[/eluser] [quote author="sl3dg3hamm3r" date="1224794720"]huh? maybe i missed something, but what's wrong with Code: $this->db->join(); Duh! I forgot that you can just use the CI database class (as long as the tables exist) and then turn on the profiler to see the queries that were made. Whatever way shows you the actual SQL ![]() Profiler says 64 Queries being run. is that too high? should i be worried? - El Forum - 10-23-2008 [eluser]Latavish[/eluser] yikes!! joins are scary. lol Profiler says 64 Queries being run. is that too high? should i be worried? - El Forum - 10-23-2008 [eluser]Colin Williams[/eluser] JOINs don't need to be too scary. Once you play with them, you'll have that Ah! Ha! moment and it will become natural thinking. And, what you want to do with queries is avoid running exact same queries two or more times (look into caching results), and avoid running similar queries (which is where JOINing can help). Profiler says 64 Queries being run. is that too high? should i be worried? - El Forum - 10-23-2008 [eluser]drewbee[/eluser] How are JOINS scary? I couldn't think of writing a query without using them (90% of the time); Are you guys properly normalizing your data? Profiler says 64 Queries being run. is that too high? should i be worried? - El Forum - 10-23-2008 [eluser]Colin Williams[/eluser] I think the biggest problem people have with JOINs (based on the questions I hear) is that you almost always have to iterate through the result to process it. |