'Are varchar(50) and varchar(10000) the same? [duplicate]

I have read a article that claim varchar(10000) would use more ram than varchar(50), but I have doubt with it. I have run a simple test:

  1. create table 'big' with one field varchar(16383)
  2. create table 'small' with one field varchar(50)
  3. insert same data to both table
  4. run 'select *' for each table, see its executing time
  5. run 'SELECT CONCAT(TRUNCATE(SUM(data_length),2),'B') AS data_size FROM information_schema.tables' for each table, see its data_size

The results of step 4 and step 5 is exactly the same between tables. I have running MySQL 8.0 with innodb. Is there actually has different with varchar(50) and varchar(10000) during query process?



Solution 1:[1]

About query process there is no difference , varchar(50) and varchar(10000) are just for number of characters the field will contain. its the same with 50 characters and with 10000 for query process , but if you try to use orderBy the response using these fields as reference than it could matter - if you have 10,000 characters of data in your rows.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Wilson Hauck