i want to settings fk between parent table and child table By the way you know that it's usually use integer type
and we can FK to varchar type but can't use text type
📌varchar , text difference
- the varchar can be used as part of index.
- the varchar is stored in memory and fast more than text
- varchar: x <= 255 then, 1 byte, 256 <= x <= 65535 then, 2 byte
- text can not be used as part of index.
- the text is stored in disk and slow more than varchar
- Unconditionally 2 byte
so text is stored on disk , and if you called query frequently , it's has a big performance difference , so you should be careful about using it
so we can set varchar to FK.