Why using username instead of user id?

Fajar A. Nugraha list at fajar.net
Mon Jan 23 13:12:25 CET 2012


On Mon, Jan 23, 2012 at 6:54 PM, Alan Buxey <A.L.M.Buxey at lboro.ac.uk> wrote:
> Hi,
>> In freeradius sql modules, queries are based on username instead of
>> user id. Is it anything related to performance or it went in this way
>> without any decision?
>>
>> Using username has two problems:
>>
>> * updating a username, or deleting one needs querying at least three tables.
>>
>> * Comparing strings needs more time than comparing integers when fetching data.
>
> umm, because in most cases, users have typed in usernames - if you tell the users
> what their userid is, then sure, they could use that instead.... but thats
> highly inflexible

On one of my systems, we use ids. It's somewhat complicated though:
- use stored procedures, as I need to use several statements to
achieve the same functionality. It's better than joins (which is very
expensive in mysql cluster)
- lookup user id based on username (on an additional table, obviously)
- lookup other properties (e.g. radcheck, radreply, etc.) based on the id

It works, and is more "ideal" (especially when you have a super-large
number of users), but definitely NOT something I'd recommend to be a
generic implementation due to the complexity.

-- 
Fajar



More information about the Freeradius-Devel mailing list