in reply to Re: combining cookies and user registration - strategies?
in thread combining cookies and user registration - strategies?

Ugh, please don't pack your data columns like "anon_xxxx". Use the DBMS. Create an anonymous column of type boolean. You really need to normalize this table heavily. See any good SQL intro on rationalization/normalization. Otherwise you are going to take a serious performance hit. Consider these two tables: Users ("anon_xxx" used in id)
id, data

vs.

Users (boolean flag)
id, anon, data

In the first example, to retrieve a given username, your perl code has to retrieve EVERY row, split the id field on "-" and check for a match.

In the other example you simply ask the database for the row(s) "where id = $userid and anon = false". The database will be much faster because it can use indexes to skip a great deal of the records and quickly zero in on the user id of your choice. Remeber, a good database (ala Postgres) will be written in C and is optimized for grinding through large amounts of data efficiently.

  • Comment on Re: Re: combining cookies and user registration - strategies?