I was thinking, say we have the following SQL table called "DemoTable" :
and say we have the following php array called demoArray:
demoArray = "One";
demoArray = "Two";
demoArray = "Three";
demoArray = "Four";
demoArray = "Five";
demoArray = "Six";
demoArray = "Severn";
demoArray = "Eight";
Say we want to get Four from demoArray, you can call demoArray and it gets the contents straight from it. But say you wanted to get Four from DemoTable, if you say:
SELECT row FROM DemoTable WHERE id=4;
Does sql go directly to the row where id=4 or does it have to itterate through all the rows to find it?
In other words, if you had a table that was 1,000,000 rows long in the same format as DemoTable, and you wanted to get Five Hundred Thousand, would it take the same time as getting Four?