[PHP-DB] Record IDs: Numeric or String??

2002-11-06 Thread Monty
Is it more efficient to store record IDs in a MySQL database as an Integer
or a String? I like string IDs better because you can create meaningful
names, but, not sure if this means the DB has to work harder or not.

Thanks!


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




Re: [PHP-DB] Record IDs: Numeric or String??

2002-11-06 Thread Marco Tabini
Numeric IDs are probably a bit faster--although if properly indexed not
by much--plus you can use self-numbering columns with them.


Marco
-- 

php|architect - The magazine for PHP Professionals
The first monthly worldwide  magazine dedicated to PHP programmer

Come visit us at http://www.phparch.com!


---BeginMessage---
Is it more efficient to store record IDs in a MySQL database as an Integer
or a String? I like string IDs better because you can create meaningful
names, but, not sure if this means the DB has to work harder or not.

Thanks!


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



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


Re: [PHP-DB] Record IDs: Numeric or String??

2002-11-06 Thread Peter Beckman
Always use ints.  Also, make sure you actually need an INT before using it:

Max Value
Unsigned Integer:   4.3 billion or so
Unsigned MediumInt: 16.7 million
unsigned SmallInt:  65,535
unsigned TinyInt:   255

If you'll only ever have 300,000 rows in a table, use a mediumint.  Saves
space and sorting time.  I use mediumint on almost all tables for primary
keys and foreign keys.

Peter

On Wed, 6 Nov 2002, Monty wrote:

 Is it more efficient to store record IDs in a MySQL database as an Integer
 or a String? I like string IDs better because you can create meaningful
 names, but, not sure if this means the DB has to work harder or not.

 Thanks!


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


---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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