Question

As I understand if you declare a column as varchar(15) or varchar(200), it makes no difference in memory size. If you store a 4-character string it should only use around 4 bytes. This is the same in Oracle for varchar2. But, for Oracle, their performance are different as the bigger size you set, the more overhead will be used.

Is it the same in MySQL (or any other database)?

Was it helpful?

Solution

  • VARCHAR:

    1. Stores strings of variable length.
    2. The length parameter specifies the maximum length of the strings
    3. It stores up to 2000 bytes of characters
    4. It will occupy space for NULL values
    5. The total length for strings is defined when database was created.
  • VARCHAR2:

    1. Stores strings of variable length.
    2. The length parameter specifies the maximum length of the strings
    3. It stores up to 4000 bytes of characters
    4. It will not occupy space for NULL values
    5. The total length of strings is defined when strings are given
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top