Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

longtext

What is the disadvantage to using a MySQL longtext sized field when every entry will fit within a mediumtext sized field?

December 4, 2023 by Tarik

The only storage size difference is the number of bytes allocated for the “how many bytes is this field” number. From the fine manual: TINYTEXT L + 1 bytes, where L < 2^8 TEXT L + 2 bytes, where L < 2^16 MEDIUMTEXT L + 3 bytes, where L < 2^24 LONGTEXT L + 4 … Read more

Categories mysql Tags comparison, longtext, mysql Leave a comment

Limit length of longtext field in SELECT results

September 15, 2023 by Tarik

Use MySQL’s SUBSTRING function, as described in the documentation. Like: SELECT SUBSTRING(`text`, 1, 100) FROM blog_entry; To select first 100 chars.

Categories mysql Tags longtext, mysql, sql, substring Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa