[MySQL] SQLID vs Name Checking
#1

Do I gain much speed, when checking by SqlID (WHERE ID = %i), instead of (WHERE NAME = '%s')?
Reply
#2

I don't think so, except if you need to get the name every time you execute a query, as opposed to the sqlid that's already stored in a variable. I myself prefer the sqlid method though, pure for my convenience.
Reply
#3

Yeah, I tested it.
pawn Код:
SELECT BENCHMARK(100000000,(SELECT `Name` FROM Accounts WHERE `Name` = 'SomeName' LIMIT 1));
SELECT BENCHMARK(100000000,(SELECT `Name` FROM Accounts WHERE `ID` = '1024' LIMIT 1));
pawn Код:
[SQL]
SELECT BENCHMARK(100000000,(SELECT `Name` FROM Accounts WHERE `Name` = 'SomeName' LIMIT 1));
Affected rows: 0
Time: 4.055ms

[SQL]
SELECT BENCHMARK(100000000,(SELECT `Name` FROM Accounts WHERE `ID` = '1024' LIMIT 1));
Affected rows: 0
Time: 4.077ms
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)