Welcome Guest, Not a member yet? Register   Sign In
Performance boost CI3
#1

(This post was last modified: 03-03-2021, 04:59 AM by muuucho.)

I have a script that has loops an array 1000s of times and in each loop runs 4 select queries. It takes one to several minutes to execute.
I need more speed.
I tried to "prepare" the queries before the loop with
PHP Code:
$query "SELECT * FROM table WHERE id = ? AND d = ?";
foreach(
foos as foo){
    $q $this->db->query($query, [$id$d])->row_array();

Not speedier.
Then I try to re-write the queries so I could use free_result() at the end of each loop. Not speedier either. Any other suggestions?
PHP Code:
$query "SELECT * FROM table WHERE id = ? AND d = ?";
foreach(
foos as foo){
    
$q $this->db->query($query, [$id$d]);
    
$row $q->row();
    
// handle the result... 
    $q->free_result();

Reply


Messages In This Thread
Performance boost CI3 - by muuucho - 03-03-2021, 04:49 AM
RE: Performance boost CI3 - by php_rocs - 03-03-2021, 08:55 AM
RE: Performance boost CI3 - by muuucho - 03-03-2021, 11:49 AM
RE: Performance boost CI3 - by InsiteFX - 03-03-2021, 12:37 PM
RE: Performance boost CI3 - by muuucho - 03-03-2021, 12:46 PM
RE: Performance boost CI3 - by php_rocs - 03-03-2021, 02:46 PM
RE: Performance boost CI3 - by muuucho - 03-03-2021, 03:26 PM
RE: Performance boost CI3 - by php_rocs - 03-04-2021, 08:15 AM
RE: Performance boost CI3 - by muuucho - 03-06-2021, 09:29 AM
RE: Performance boost CI3 - by iRedds - 03-06-2021, 12:32 PM
RE: Performance boost CI3 - by muuucho - 03-07-2021, 04:11 AM
RE: Performance boost CI3 - by php_rocs - 03-09-2021, 09:53 AM
RE: Performance boost CI3 - by muuucho - 03-09-2021, 02:31 PM
RE: Performance boost CI3 - by php_rocs - 03-09-2021, 08:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB