SQLite quick question, which is faster?
#1

Hi, i'm making my gamemode to work with sqlite and i want to make it work as fast as possible, so i have a question:
їWhich method will get the query faster? Or it's the same?

1st way:
Код:
format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `username` = '%s' LIMIT 1", Nick(playerid));
Result = db_query(Database, Query);
2nd way:
NOTE: IDD is the ID retrieved from player data at a sqlite table.
Код:
format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `ID` = '%d' LIMIT 1", PlayerInfo[playerid][IID]);
Result = db_query(Database, Query);
Nick stock:
Код:
stock Nick(playerid)
{
  new nname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, nname, sizeof(nname));
return 	nname;
}
So, which method will work faster? Thanks!
Reply
#2

2nd way its faster
Reply
#3

2nd one because comparing integer takes less time than strings.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)