View Full Version : PHP or MySQL: which is faster in this scenario?
I've written an upload script, and I need it to check if the filename it's uploading already exists on the server every time somebody uploads something. I have two methods of checking, one using PHP's file_exists, the other is grabbing the table from MySQL. The question is, which method is more efficient, or less server-extensive?
Gonzo
May 19th, 2009, 22:41
Hi there,
If you know where the file will be located, without looping directories, I would pick file_exists.
Ps: its nice to see some of the orginal members are still around, from Oct. 2000!
Yah, I still lurk here from time to time, mainly in the general discussion section. ;)
Thanks by the way.
iBrightDev
May 20th, 2009, 00:36
i wouldnt really say either one is that much quicker just cause either way it needs to scan for the file name. file_exists, from what i have read is a little faster, but, i am not 100% on that. if Joe was still around, he would be the best person to ask, but, Carl may have some input on that. good to see you lurking still brother. i havent been to active myself lately, but, still around.
stuffradio
May 20th, 2009, 22:53
IMO I think file_check would probably work the best so you don't have to keep checking mysql tables if you have a lot of files on your server.
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.