PHPGuru
3-13-03, 03:11 AM
Hi,
Which one of the followings is better in speed and securitywise for retrieving data?
1) At the point of successfully logging in, save the data in session from the database, and when the same data is needed later on, retrieve them from the session.
2) Each time you need data, retrieve them from the database.
I've read a lot of PHP, MySQL documents from many sites, but I'm still not sure which one is better.
For example, one site said that retrieving data from session is not a good idea since PHP4 basically stores data in text-based session, so it takes longer to read/write. Also, when the access to the one folder (where session files are stored) gets bigger, that slows down the speed. Also, session ID can be stolen therefore it's not safe to store sensitive data in the session.
2 is not also a good idea for a place like Powweb since the number of times you can call SQL queries to the database is limited.
From what I understand, reading/writing data from/to the database is faster than reading/writing data from/to the text file (session), so 2 may be a better choice, but what do you guys think and could you give me your opinion or advice?
Thanks!
PHPGuru
Which one of the followings is better in speed and securitywise for retrieving data?
1) At the point of successfully logging in, save the data in session from the database, and when the same data is needed later on, retrieve them from the session.
2) Each time you need data, retrieve them from the database.
I've read a lot of PHP, MySQL documents from many sites, but I'm still not sure which one is better.
For example, one site said that retrieving data from session is not a good idea since PHP4 basically stores data in text-based session, so it takes longer to read/write. Also, when the access to the one folder (where session files are stored) gets bigger, that slows down the speed. Also, session ID can be stolen therefore it's not safe to store sensitive data in the session.
2 is not also a good idea for a place like Powweb since the number of times you can call SQL queries to the database is limited.
From what I understand, reading/writing data from/to the database is faster than reading/writing data from/to the text file (session), so 2 may be a better choice, but what do you guys think and could you give me your opinion or advice?
Thanks!
PHPGuru