Speed test: mysql query vs. file_exists()
| From: | qartis | Date: | Thu, 24 Jan 2002 23:53:14 +0000 |
| Subject: | Speed test: mysql query vs. file_exists() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-82007@lists.php.net to get a copy of this message | ||
I'm running a logs system where log entries are .log files with filenames
like 03012002.log for January 3rd, 2002. You can view when logs have been
posted with a calendar, which will make the particular day a link if that
day's log file exists. I'm thinking of storing the log entries in a mysql
database, using code somewhat like the following:
$query = "select username, log, date_format(date, '%a %b %D') as date, from
logs where username = $username";
$dates = mysql_db_query($bb_news_db, $query) or die("Select Failed!");
while ($row = mysql_fetch_array($dates)) {
$date[row[$dates]]=1;
}
So that each log entry would be put in the $date[] array, and then when the
calendar script wanted to find out if there was an entry by that user on
that particular day, it would just have to check the $date[] array.Will
there be any speed difference between this and my current (file_exists();)
method?