I am using mysql driven application where in all data comes from mysql and display it using php.
when designing the DB what all precautions must be taken so that mysql gives best performance.
i had a small doubt . I have text column in my form , and i dono how much length data will be entered . So instead of varchar(255) if i create it as varchar(2000) does it effects the performance ?
varchar takes the number of bytes of the data + length prefix regardless of the length define
eg.
‘xyz’ will take 4 bytes, 3 bytes for the data and 1 or 2 bytes will be added for length prefix, A column uses 1 byte if values require no more than 255 bytes, 2 bytes if values may require more than 255 bytes. In this case 1 byte will add up since data require less than 255 bytes.
So go on buddy affect on the performance is negligible, that’s the beauty of VARCHAR.