0

So i have a table which has to hold a dynamic size of a string. Is the TEXT Datatype efficient enough or is there somekind of vartext like varchar?

i can imagine that there are some other datatypes like LONGTEXT but im not sure i this takes up more space. Can someone explain these different dataypes and what effect on efficiency they have?

  • 1
    The difference between TEXT and VARCHAR is that the contents are stored in a separate file instead of the main database file. This tends to be good for very large texts. If the max length is only a few hundred bytes, VARCHAR is probably better. – Barmar May 12 '23 at 17:21
  • @Barmar, Assuming InnoDB storage engine, TEXT and VARCHAR are stored in virtually an identical way. Both TEXT and VARCHAR may use extra pages, but they are in the same tablespace file as the rest of that table's data and indexes, not a separate file. – Bill Karwin May 12 '23 at 17:49

0 Answers0