I was thinking, say we have the following SQL table called “DemoTable” :
id row
** ***
1 One
2 Two
3 Three
4 Four
5 Five
6 Six
7 Severn
8 Eight
and say we have the following php array called demoArray:
demoArray[0] = "One";
demoArray[1] = "Two";
demoArray[2] = "Three";
demoArray[3] = "Four";
demoArray[4] = "Five";
demoArray[5] = "Six";
demoArray[6] = "Severn";
demoArray[7] = "Eight";
Say we want to get Four from demoArray, you can call demoArray[3] 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?
Thanks
ro0bear