Welcome Guest, Not a member yet? Register   Sign In
Impact on script execution time
#1

[eluser]Aniket[/eluser]
what is the impact of having multiple
Code:
$db1=$this->load->db('xyzdb',true);

my requirement is m connecting to same database and executing at least 20 "select" queries with different "where" parameters using active record class.
will it have impact on execution time of the script ?
I have set my scripts execution time to
Code:
set_time_limit(0);
I profiled the script on localhost and it takes around 4 seconds...but what if i execute on a live website ?
Actually i am writing a newsletter application which contains many different topics and is sends to more than 8000 users ?

Thanks in advance
#2

[eluser]rogierb[/eluser]
Why would you want to load the database more then once?
Just load is once. And then use it whenever you need.

We do the same with multiple databases, load it when needed and leave the connection open until the end of the script.

But somehow I get the feeling this is not an answer to your question, or maybe I'm just notunderstanding the question;-)
#3

[eluser]Aniket[/eluser]
Actually i am suppose to reverse engineer the code and provide an optimized solution so was bit hesitant in making any changes in the code. Will try the way you have suggested Smile
#4

[eluser]Jondolar[/eluser]
If you're trying to get all the records from the same query with different "where" parameters, maybe you want to use an "or" clause and put all of your where parameters in one query.

Select * from table1 where field1='abc' or field2='def' or field1='zzz'




Theme © iAndrew 2016 - Forum software by © MyBB