Welcome Guest, Not a member yet? Register   Sign In
[UPDATED 2009-03-09] Improved "queries efficient" CI Session library
#1

[eluser]Matthieu Fauveau[/eluser]
Hi guys,

I don't know if you noticed it yourself but using Flashdatas and CI native Session library can make several unefficient queries and therefor slow down the loading of your website.

Following is a modified library that will make one SELECT and one UPDATE - if needed - instead of several UPDATE queries.

I'm currently testing it and it seems to work great. Your inputs are obviously welcome.

Matt.

*** UPDATED 2009-03-09 ***

Just noticed that CI stores IP addresses as strings, it's however an unefficient way of storing IP addresses which are basically unsigned 32-bit integer. MySQL will also perform better when doing an integer comparison instead of a string comparison.

The attached file has been updated to take this changes into account. You will need to ALTER your session table using the following command for it to work :
Code:
ALTER TABLE `ci_sessions` CHANGE `ip_address` `ip_address` INT UNSIGNED NOT NULL DEFAULT '0'
#2

[eluser]Wuushu[/eluser]
Bump Smile
#3

[eluser]Matthieu Fauveau[/eluser]
Thanks for bumping Wuushu Wink
I'm hoping CI guys see that post.
#4

[eluser]johnwbaxter[/eluser]
If you want it noticed you should post it in the feature requests forum or maybe even the bug reports forum if you think the under efficiency is worthy of it being a bug Wink
#5

[eluser]Matthieu Fauveau[/eluser]
I see your point. I don't think it should be considered as a bug tho. And it's not a feature request either... Anyways I'm sure one of the Dereks will notice that post Wink
#6

[eluser]Matthieu Fauveau[/eluser]
Just updated the post to add a little MySQL trick that also improve efficiency (only under high load but still).
#7

[eluser]Xeoncross[/eluser]
Thanks, this is one thing that really bothers me as well. I don't like seeing lots of queries for session data in my logs...




Theme © iAndrew 2016 - Forum software by © MyBB