Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. storing image in blob vs text?

storing image in blob vs text?

Scheduled Pinned Locked Moved Database
mysqlvisual-studiocomperformancequestion
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jassim Rahma
    wrote on last edited by
    #1

    Hi, I want to ask what's the best way to store images in MySQL size-wise and performance-wise? is it better to store it as blob or as base64 text? Thanks, Jassim[^]

    Technology News @ www.JassimRahma.com

    M L J 3 Replies Last reply
    0
    • J Jassim Rahma

      Hi, I want to ask what's the best way to store images in MySQL size-wise and performance-wise? is it better to store it as blob or as base64 text? Thanks, Jassim[^]

      Technology News @ www.JassimRahma.com

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      Don't store file data in the database, store it in the file system and have the file name in the database only. Just my 2c!

      Never underestimate the power of human stupidity RAH

      L 1 Reply Last reply
      0
      • J Jassim Rahma

        Hi, I want to ask what's the best way to store images in MySQL size-wise and performance-wise? is it better to store it as blob or as base64 text? Thanks, Jassim[^]

        Technology News @ www.JassimRahma.com

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Converting your blob yo base64 will cost time, and the result would be somewhat bigger.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

        1 Reply Last reply
        0
        • M Mycroft Holmes

          Don't store file data in the database, store it in the file system and have the file name in the database only. Just my 2c!

          Never underestimate the power of human stupidity RAH

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          If it is relational data, then it should be in the datastore :thumbsup:

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

          1 Reply Last reply
          0
          • J Jassim Rahma

            Hi, I want to ask what's the best way to store images in MySQL size-wise and performance-wise? is it better to store it as blob or as base64 text? Thanks, Jassim[^]

            Technology News @ www.JassimRahma.com

            J Offline
            J Offline
            Jorgen Andersson
            wrote on last edited by
            #5

            Here's[^] a research document from Microsoft on the subject. The tl;dr is that it's size dependent. For smaller files it's better using a database, for larger files it's better using the file system. And the breakeven is somewhere around 0.1 - 1 MB, depending on your system. Possibly larger nowadays since there has been a bit of development since the paper was written.

            Wrong is evil and must be defeated. - Jeff Ello

            D 1 Reply Last reply
            0
            • J Jorgen Andersson

              Here's[^] a research document from Microsoft on the subject. The tl;dr is that it's size dependent. For smaller files it's better using a database, for larger files it's better using the file system. And the breakeven is somewhere around 0.1 - 1 MB, depending on your system. Possibly larger nowadays since there has been a bit of development since the paper was written.

              Wrong is evil and must be defeated. - Jeff Ello

              D Offline
              D Offline
              david_smith01
              wrote on last edited by
              #6

              TEXT is a data-type for text based input. On the other hand, you have BLOB and CLOB which are more suitable for data storage (images, etc) due to their larger capacity limits (4GB for example). As for the difference between BLOB and CLOB, I believe CLOB has character encoding associated with it, which implies it can be suited well for very large amounts of text. BLOB and CLOB data can take a long time to retrieve, relative to how quick data from a TEXT field can be retrieved. So, use only what you need. =============== Parse Migration Services

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups