Working on very big project and trying to create optimal database usage. I heard that it's not recomended to save user id's in $_SESSION variables. I can actually work with only tokens, this tokens are assigned to user id's in database. The problem is, if I will work with only tokens, I need to do 1 extra operation (query) with database inside script. So the question is, may I save user id inside $_SESSION variables to prevent ectra database operations? How "dangerous" it might be?
Thx in advance.