[PHP-DB] Re: [PHP] number of files in a dir vs. performace

2002-07-22 Thread Miguel Cruz

On Mon, 22 Jul 2002, eat pasta type fasta wrote:
 currently I am holding all of the files in 1 directory since the DB can 
 keep track of them, however their number has grown to over 400 at this 
 point
 
 my issue is whether it would be worth it (performance wise) to split them 
 into thumbs and works thus having 200+ files per directory as opposed to 
 so many, I am expecting the number of images to double in the future.

400 is not very many. Tens of thousands can start to become a problem.

Look at the distribution of your file names and come up with a hashing 
mechanism. For instance, if your filenames are numbers, create 
subdirectories 0/ 1/ 2/ 3/ 4/ etc., and place the files based on their 
final digit.

miguel


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Re: [PHP] date problem

2002-06-05 Thread Miguel Cruz

On Thu, 6 Jun 2002, andy wrote:
 I would like to count the users out of a mysql db who registered after a
 certain date.
 
 The column I have in the db is a char and I do not want to change this
 anymore.
 This is how a typical entry looks like: May 29, 2002
 
 This is how I tryed it:
 
 // while '10...' is unix timestamp june 1, 02
 SELECT COUNT(*) AS c
 FROM users_table
 WHERE UNIX_TIMESTAMP( user_regdate )  '1022882400'

You can only call UNIX_TIMESTAMP on a DATE or DATETIME field, not on just
any generic CHAR/VARCHAR/TEXT/whatever. May 29, 2002 isn't a MySQL
timestamp, so I'm guessing you have a textual field type.

The lesson of all this is: Convert dates to either unix or database-native 
date format before storing them in the database. Things like May 29, 
2002 are useless in a database.

At this point I'd recommend running a quick script to strtotime() all your
dates and then re-write them to a new field that's in a proper format.

miguel


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php