PDA

View Full Version : which way will be faster ?


miz
02-07-2005, 01:18 PM
ok like its like that

i got table with id,name,info,info,and,more,info

heh

now this table will be bigger and bigger with the time
can be more then 70000 rows
can be on 5000

so i thought to make new dir
with ids

empty file that will be like 55214.txt
file size : 0bytes

then in php do


if (file_exsits("ids/55214.txt")
{
//query to get info from id 55214
//echo info
} else {
echo " Not Found";
}



way 2 :

$bla = selcet * from table where id=$id
if (!$bla) {
echo " Not Found";
} else {
//show info
}


which way will be faster ??

Dean C
02-07-2005, 02:12 PM
Database retrieval tends to be faster than files :up:

Marco van Herwaarden
02-07-2005, 02:56 PM
Database will be faster yes, especially because you limit the query to max 1 row, using the primary index (i asume).

Andreas
02-07-2005, 02:59 PM
70.000 rows is ... nothing ;)

Our postindex table has got more then 40.000.000 rows ^.^

miz
02-07-2005, 03:21 PM
so its will be faster to use a query to search in db ? then check if file exsits ?