SA-MP Forums Archive
SQLite quick question, which is faster? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SQLite quick question, which is faster? (/showthread.php?tid=613328)



SQLite quick question, which is faster? - LoLeRo - 26.07.2016

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!


Re: SQLite quick question, which is faster? - Rockefeller - 26.07.2016

2nd way its faster


Re: SQLite quick question, which is faster? - Gammix - 26.07.2016

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