PDA

View Full Version : How efficient are simple repeated MYSQL statements?


NeilFawcett
2-1-06, 12:27 PM
I'm looking to having some Perl scripts which validate logons against the users in VBulletin Boards user table. Furthermore, ideally I'd like to piggy back extra features in the perl script on if the user is sibscribed or not (in VBulletin).

I've written a test perl script to do this and can grab a users record, and then see their (encrypted) password, so I imagine this could then be validated against the value in their cookies etc... (Cookies would be mandatory I'm guessing)

However, I have two choices. Each time the perl script is run/moved around, it would re-perform the SQL read to validate the request is from a valid user. Or alternatively, have a simple text session file controlled from perl such that first time in the users id is checked they are given a session id. This session is then removed if not used for say 30 mins.

This would mean that rather than reading the SQL database everytime, it would most likely have to be read when a user first access the perl script, and from then on the text session file would ensure the request is from a valid user.

Now accessing the SQL database is obviously the easiest and most straight forward solution, but I have no idea of how efficient this would be. ie: If it would be less or more efficient (IO wise) than maintaining a simple text session file - IO is my main concern as I'm potentially doing all of this simply to reduce my high IO processes.

Can anyone with some MYSQL knowledge comment if accessing a user records repeatedly is any real issue?


From existing logs I can see the script would be hit about say 700 times day...