Query optimization
vgarvardt - May 30, 2008 - 14:04
| Project: | Login Ticket API |
| Version: | 5.x-1.5 |
| Component: | Code |
| Category: | bug report |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Not a bug actually, but minor optimization feature.
loginticket.module, string 68-69, query:
SELECT * FROM {loginticket} WHERE passcode_md5 = '%s' AND purpose = '%s'
but passcode_md5 is PRIMARY KEY for loginticket table, so it is unique and second part of sql query condition is obsolete.

#1
Hm... actually, I think that passcode_md5 and purpose should probably make up the primary key together, as the purposes (say, different API users) should be completely independent from each other. Well, just one reason more to replace passcode_md5 by a "real" incrementing id number.
#2
Primary key has changed to a serial
ticket_id, but in order to prevent possible collisions I've left a unique index onpassword_md5. This makes this optimization still valid, so I've updated the code to include it.#3
Automatically closed -- issue fixed for 2 weeks with no activity.