To honestly answer your question, I would say try both and use whichever
method gives you the best performance in your application.

I don't actually know if the ZEROFILL option forces those zeroes onto the
disk during the write (so that the column is stored that way) or if it is a
signal to the engine to LPAD() that column during retrieval. Storing the
leading zeroes could take up more space (or not if the engine stores the
numbers in fixed widths) but would definitely save time on post-read
processing (adding the leading zeroes to the retrieved number for every row
returned)

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine



                                                                                       
                                          
                      'Jacob Elder '                                                   
                                          
                      <[EMAIL PROTECTED]>           To:       "'''[EMAIL PROTECTED] ' 
' '" <[EMAIL PROTECTED]>                
                                               cc:                                     
                                          
                      05/18/2004 05:02         Fax to:                                 
                                          
                      PM                       Subject:  Re: Simple table, 1.7 million 
rows, very slow SELECTs                   
                                                                                       
                                          
                                                                                       
                                          




On Tue 18 May 02004 at 04:53:52PM -0400, [EMAIL PROTECTED] wrote:
>
> Jacob,
>
> Don't worry about storing the leading the zeroes. Just left pad the
> subscriber column to be 4 digits on output and you should be golden.
MySQL
> has a function just to generate left-padded numbers:
>
> LPAD(subscriber,4,'0')
>
> Yours,
> Shawn Green
> Database Administrator
> Unimin Corporation - Spruce Pine

I just came across ZEROFILL in the manual. When would I want to use LPAD
rather than ZEROFILL?

--
Jacob Elder

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]







-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to