SimplePortal

Development => Bugs => Fixed or Bogus Bugs => Topic started by: ???1031 on August 29, 2008, 04:18:39 PM

Title: Some database querys i think can be prevented
Post by: ???1031 on August 29, 2008, 04:18:39 PM
So this is also not a real bug ;) but i think it could be made a little bit better ;).

Code: [Select]
      SELECT ID_BLOCK, label, type, content, parameters, col, row, state, force_view, allowed_groups
      FROM smf_portal_sp_blocks WHERE col = '1' AND state = '1' ORDER BY row
   in C:\az\x\xampp\htdocs\intranet\forum\smf-Portal\Sources\Subs-SPortal.php line 37, which took 0.00803614 seconds.

      SELECT allowed_groups
      FROM smf_portal_sp_blocks
      WHERE ID_BLOCK = 1
      LIMIT 1
   in C:\az\x\xampp\htdocs\intranet\forum\smf-Portal\Sources\Subs-SPortal.php line 342, which took 0.00171208 seconds.

      SELECT ID_BLOCK, label, type, content, parameters, col, row, state, force_view, allowed_groups
      FROM smf_portal_sp_blocks WHERE col = '2' AND state = '1' ORDER BY row
   in C:\az\x\xampp\htdocs\intranet\forum\smf-Portal\Sources\Subs-SPortal.php line 37, which took 0.00187016 seconds.

      SELECT allowed_groups
      FROM smf_portal_sp_blocks
      WHERE ID_BLOCK = 3
      LIMIT 1
   in C:\az\x\xampp\htdocs\intranet\forum\smf-Portal\Sources\Subs-SPortal.php line 342, which took 0.0012691 seconds.

      SELECT ID_BLOCK, label, type, content, parameters, col, row, state, force_view, allowed_groups
      FROM smf_portal_sp_blocks WHERE col = '3' AND state = '1' ORDER BY row
   in C:\az\x\xampp\htdocs\intranet\forum\smf-Portal\Sources\Subs-SPortal.php line 37, which took 0.00236201 seconds.

      SELECT allowed_groups
      FROM smf_portal_sp_blocks
      WHERE ID_BLOCK = 4
      LIMIT 1
   in C:\az\x\xampp\htdocs\intranet\forum\smf-Portal\Sources\Subs-SPortal.php line 342, which took 0.00135708 seconds.

      SELECT ID_BLOCK, label, type, content, parameters, col, row, state, force_view, allowed_groups
      FROM smf_portal_sp_blocks WHERE col = '4' AND state = '1' ORDER BY row
   in C:\az\x\xampp\htdocs\intranet\forum\smf-Portal\Sources\Subs-SPortal.php line 37, which took 0.00227499 seconds.

      SELECT allowed_groups
      FROM smf_portal_sp_blocks
      WHERE ID_BLOCK = 5
      LIMIT 1
   in C:\az\x\xampp\htdocs\intranet\forum\smf-Portal\Sources\Subs-SPortal.php line 342, which took 0.00133419 seconds.

This looks like double query's for me ;).
Because you already load the "allowed_groups" data, after that you give to a other function that load it again. I think you can use the already loaded data to make a checkup of the already loaded data. Or a better way is to store this data in a "cache like" array so that the function don't need to load this data again because it's already stored in this array ;).

Only a idea, not bug but i think this will improve a little bit the script and make it smother. 

(I also think the blocks can be loaded in one step ;P, and split if it go though the rows, but thats something else.)

Bye
The Beta Testing ???1031 ;P
Title: Re: Some database querys i think can be prevented
Post by: Eliana Tamerin on August 29, 2008, 04:32:22 PM
Thanks, ???1031, I'll cue our Developers' attention.
Title: Re: Some database querys i think can be prevented
Post by: Nathaniel on August 29, 2008, 07:47:46 PM
Thanks for reporting that.

Added to the BugTracker and marked as solved. ;)
SimplePortal 2.3.8 © 2008-2024, SimplePortal