Welcome Guest, Not a member yet? Register   Sign In
Can I use both regular and db-sessions at the same time?
#1

[eluser]arvid.janson[/eluser]
Currently I'm using DB-sessions, and it works OK. I do feel that adding flash_messages causes quite a bit overhead on my mysql-server, with a whole lot of unneccesary updates - for instance:

When a user tries to login, but fails, i use flash data to store the email, and a short message informing the user that something went wrong. The app uses one select and two updates to add the data (quite alright), and then one select and FOUR updates to retrieve it (I'm not writing anything new here, just getting the flash_data on a couple of places).

So ideally I would like to store some parts of the data (userinfo) using the database sessions, and some parts (flashdata messages) using "regular" session data. Is this possible? Or else, is there any way of dealing with this issue in a better way - a more effecient way of handling flash messages or better approach all together?


Regards,
Arvid

EDIT: Updated with a better title
#2

[eluser]Jaketoolson[/eluser]
Better queries using better joins and subqueries?
#3

[eluser]arvid.janson[/eluser]
I'm using the included CI session-library - not looking to rewrite this if it's avoidable.
#4

[eluser]Jaketoolson[/eluser]
Quote:I do feel that adding flash_messages causes quite a bit overhead on my mysql-server, with a whole lot of unneccesary updates

2-3 tiny update queries won't break your system. Run benchmarks on the queries. Why spend all this time stressing over it when mysql's purpose is to provide you with a database system you can use. Are you running myisam or innodb? you could even try settting up some tables as MEMORY (heap) as they are extremely fast up to 33% faster than myisam and 50% than innodb. Because it is a memory table if mysql goes offline or something, these tables are wiped clean. But they are perfect for storing messages etc;
#5

[eluser]arvid.janson[/eluser]
Ok, thanks, I guess I'll just leave it alone then.

I don't really know that much about DBConfused (read: nothing), but having a bunch of extra queries felt unnecessary. But, I'll take a look at that part instead, and stop worring about having doubled queries.
#6

[eluser]Jaketoolson[/eluser]
I agree, excessive queries can be unnecessary so work on figuring out how to rewrite the queries so that what would have taken 4 queries only takes 1, maybe 2. Understanding databases is just as important as understanding the code used to interact with them. Optimizing your database can help too and not just running the optimize procedure, but creating the optimal structure on a per table basis. Small things are often overlooked when it comes to databases where when fixed, this can cause the DB to perform faster and better than anything php or code wise could ever do!
#7

[eluser]InsiteFX[/eluser]
As for your messages you could store them in either a lang file or config file. Then only store the info you need in the database.

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB