BLOB or VARBINARY to store simple Strings that are converted into byte[ ]?Database redesign opportunity: What...

How to not let the Identify spell spoil everything?

What species should be used for storage of human minds?

Minimum Viable Product for RTS game?

Why did Ylvis use "go" instead of "say" in phrases like "Dog goes 'woof'"?

Did ancient Germans take pride in leaving the land untouched?

What's the winning box for the King in a Queen against 7th rank Bishop-pawn endgame?

Identical projects by students at two different colleges: still plagiarism?

'DataFrame' object has no attribute 'to_dataframe'

How can find the 2D Voronoi cell area distribution?

If I tried and failed to start my own business, how do I apply for a job without job experience?

Stuck to wireframe

Why is it that Bernie Sanders is always called a "socialist"?

Given a total recursive function, can you always compute its fixed-point?

Calculating the strength of an ionic bond that contains poly-atomic ions

Bug in VectorFieldPlot[] with InterpolatingFunction[]?

What is an efficient way to digitize a family photo collection?

What does an unprocessed RAW file look like?

Equivalent of "illegal" for violating civil law

Maybe pigeonhole problem?

How resistance converts voltage to current?

Boss asked me to sign a resignation paper without a date on it along with my new contract

Why is Shelob considered evil?

Why is "rm -r" unable to delete this folder?

What's the reason that we have a different number of days each month?



BLOB or VARBINARY to store simple Strings that are converted into byte[ ]?


Database redesign opportunity: What table design to use for this sensor data collection?How to setup complex multi-column index for massive tableWhy are simple SELECTs on InnoDB 100x slower than on MyISAM?Insert string content into a blob in DB2 database using a simple SQL queryOptimizing a group by/where in/min() query in MySQLMysql Server 5.6 high memory consumptionLOB_DATA, slow table scans, and some I/O questionsSOLUTION - OOM Killer was killing mariadb every hour or so













0















I've read that In MySQL, BLOBs are often used to store image files, file path pointers, video & audio files, and any other big data objects.



But can BLOBs be used for simple Strings that are converted into byte[] (like names, address, etc.) or would VARBINARY suffice?



Or does it not really impact the database size and query performance?










share|improve this question














bumped to the homepage by Community 4 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    0















    I've read that In MySQL, BLOBs are often used to store image files, file path pointers, video & audio files, and any other big data objects.



    But can BLOBs be used for simple Strings that are converted into byte[] (like names, address, etc.) or would VARBINARY suffice?



    Or does it not really impact the database size and query performance?










    share|improve this question














    bumped to the homepage by Community 4 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0








      I've read that In MySQL, BLOBs are often used to store image files, file path pointers, video & audio files, and any other big data objects.



      But can BLOBs be used for simple Strings that are converted into byte[] (like names, address, etc.) or would VARBINARY suffice?



      Or does it not really impact the database size and query performance?










      share|improve this question














      I've read that In MySQL, BLOBs are often used to store image files, file path pointers, video & audio files, and any other big data objects.



      But can BLOBs be used for simple Strings that are converted into byte[] (like names, address, etc.) or would VARBINARY suffice?



      Or does it not really impact the database size and query performance?







      mysql query-performance blob varbinary






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 6 '18 at 7:45









      Jae BinJae Bin

      163




      163





      bumped to the homepage by Community 4 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 4 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          2 Answers
          2






          active

          oldest

          votes


















          0














          Main differences between VARBINARY and BLOB are:




          • VARBINARY must have length specification, BLOB must not (but may);

          • Index by BLOB must have prefix length specification, VARBINARY must not (but may);

          • VARBINARY may have default value, BLOB cannot.



          can BLOBs be used for simple Strings that are converted into byte[] (like names, address, etc.) or would VARBINARY suffice?




          Both variants are possible. The influence on the query performance depends of the query.






          share|improve this answer

































            0















            does it not really impact the database size and query performance.




            As per MySQL documentation The BLOB and TEXT Types In most respects, you can regard a BLOB column as a VARBINARY column that can be as large as you like. Similarly, you can regard a TEXT column as a VARCHAR column. BLOB and TEXT differ from VARBINARY and VARCHAR in the following ways:




            • For indexes on BLOB and TEXT columns, you must specify an index
              prefix length. For CHAR and VARCHAR, a prefix length is optional. See

              Section 8.3.5, “Column Indexes”".

            • BLOB and TEXT columns cannot have DEFAULT values

            • Instances of BLOB or TEXT columns in the result of a query that is
              processed using a temporary table causes the server to use a table on
              disk rather than in memory because the MEMORY storage engine does not
              support those data types (see
              Section 8.4.4, “Internal Temporary Table Use in MySQL”). Use of
              disk incurs a performance penalty, so include BLOB or TEXT columns in
              the query result only if they are really needed. For example, avoid
              using SELECT
              *, which selects all columns.

            • The maximum size of a BLOB or TEXT object is determined by its type,
              but the largest value you actually can transmit between the client
              and server is determined by the amount of available memory and the
              size of the communications buffers. You can change the message buffer
              size by changing the value of the max_allowed_packet
              variable, but you must do so for both the server and your client
              program. For example, both mysql
              and mysqldump
              enable you to change the client-side max_allowed_packet
              value. See Section 5.1.1, “Configuring the Server”, Section 4.5.1, “mysql —
              The MySQL Command-Line Tool”, and Section
              4.5.4, “mysqldump — A Database Backup Program”. You may also want to compare the packet sizes and the size of the data objects you are
              storing with the storage requirements, see Section
              11.8, “Data Type Storage Requirements”


            Each BLOB or TEXT value is represented internally by a separately allocated object. This is in contrast to all other data types, for which storage is allocated once per column when the table is opened.



            In some cases, it may be desirable to store binary data such as media files in BLOB or TEXT columns. You may find MySQL's string handling functions useful for working with such data. See Section 12.5, “String Functions”. For security and other reasons, it is usually preferable to do so using application code rather than giving application users the FILE privilege.






            share|improve this answer

























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "182"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f221886%2fblob-or-varbinary-to-store-simple-strings-that-are-converted-into-byte%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              Main differences between VARBINARY and BLOB are:




              • VARBINARY must have length specification, BLOB must not (but may);

              • Index by BLOB must have prefix length specification, VARBINARY must not (but may);

              • VARBINARY may have default value, BLOB cannot.



              can BLOBs be used for simple Strings that are converted into byte[] (like names, address, etc.) or would VARBINARY suffice?




              Both variants are possible. The influence on the query performance depends of the query.






              share|improve this answer






























                0














                Main differences between VARBINARY and BLOB are:




                • VARBINARY must have length specification, BLOB must not (but may);

                • Index by BLOB must have prefix length specification, VARBINARY must not (but may);

                • VARBINARY may have default value, BLOB cannot.



                can BLOBs be used for simple Strings that are converted into byte[] (like names, address, etc.) or would VARBINARY suffice?




                Both variants are possible. The influence on the query performance depends of the query.






                share|improve this answer




























                  0












                  0








                  0







                  Main differences between VARBINARY and BLOB are:




                  • VARBINARY must have length specification, BLOB must not (but may);

                  • Index by BLOB must have prefix length specification, VARBINARY must not (but may);

                  • VARBINARY may have default value, BLOB cannot.



                  can BLOBs be used for simple Strings that are converted into byte[] (like names, address, etc.) or would VARBINARY suffice?




                  Both variants are possible. The influence on the query performance depends of the query.






                  share|improve this answer















                  Main differences between VARBINARY and BLOB are:




                  • VARBINARY must have length specification, BLOB must not (but may);

                  • Index by BLOB must have prefix length specification, VARBINARY must not (but may);

                  • VARBINARY may have default value, BLOB cannot.



                  can BLOBs be used for simple Strings that are converted into byte[] (like names, address, etc.) or would VARBINARY suffice?




                  Both variants are possible. The influence on the query performance depends of the query.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 6 '18 at 8:10

























                  answered Nov 6 '18 at 8:05









                  AkinaAkina

                  4,0741311




                  4,0741311

























                      0















                      does it not really impact the database size and query performance.




                      As per MySQL documentation The BLOB and TEXT Types In most respects, you can regard a BLOB column as a VARBINARY column that can be as large as you like. Similarly, you can regard a TEXT column as a VARCHAR column. BLOB and TEXT differ from VARBINARY and VARCHAR in the following ways:




                      • For indexes on BLOB and TEXT columns, you must specify an index
                        prefix length. For CHAR and VARCHAR, a prefix length is optional. See

                        Section 8.3.5, “Column Indexes”".

                      • BLOB and TEXT columns cannot have DEFAULT values

                      • Instances of BLOB or TEXT columns in the result of a query that is
                        processed using a temporary table causes the server to use a table on
                        disk rather than in memory because the MEMORY storage engine does not
                        support those data types (see
                        Section 8.4.4, “Internal Temporary Table Use in MySQL”). Use of
                        disk incurs a performance penalty, so include BLOB or TEXT columns in
                        the query result only if they are really needed. For example, avoid
                        using SELECT
                        *, which selects all columns.

                      • The maximum size of a BLOB or TEXT object is determined by its type,
                        but the largest value you actually can transmit between the client
                        and server is determined by the amount of available memory and the
                        size of the communications buffers. You can change the message buffer
                        size by changing the value of the max_allowed_packet
                        variable, but you must do so for both the server and your client
                        program. For example, both mysql
                        and mysqldump
                        enable you to change the client-side max_allowed_packet
                        value. See Section 5.1.1, “Configuring the Server”, Section 4.5.1, “mysql —
                        The MySQL Command-Line Tool”, and Section
                        4.5.4, “mysqldump — A Database Backup Program”. You may also want to compare the packet sizes and the size of the data objects you are
                        storing with the storage requirements, see Section
                        11.8, “Data Type Storage Requirements”


                      Each BLOB or TEXT value is represented internally by a separately allocated object. This is in contrast to all other data types, for which storage is allocated once per column when the table is opened.



                      In some cases, it may be desirable to store binary data such as media files in BLOB or TEXT columns. You may find MySQL's string handling functions useful for working with such data. See Section 12.5, “String Functions”. For security and other reasons, it is usually preferable to do so using application code rather than giving application users the FILE privilege.






                      share|improve this answer






























                        0















                        does it not really impact the database size and query performance.




                        As per MySQL documentation The BLOB and TEXT Types In most respects, you can regard a BLOB column as a VARBINARY column that can be as large as you like. Similarly, you can regard a TEXT column as a VARCHAR column. BLOB and TEXT differ from VARBINARY and VARCHAR in the following ways:




                        • For indexes on BLOB and TEXT columns, you must specify an index
                          prefix length. For CHAR and VARCHAR, a prefix length is optional. See

                          Section 8.3.5, “Column Indexes”".

                        • BLOB and TEXT columns cannot have DEFAULT values

                        • Instances of BLOB or TEXT columns in the result of a query that is
                          processed using a temporary table causes the server to use a table on
                          disk rather than in memory because the MEMORY storage engine does not
                          support those data types (see
                          Section 8.4.4, “Internal Temporary Table Use in MySQL”). Use of
                          disk incurs a performance penalty, so include BLOB or TEXT columns in
                          the query result only if they are really needed. For example, avoid
                          using SELECT
                          *, which selects all columns.

                        • The maximum size of a BLOB or TEXT object is determined by its type,
                          but the largest value you actually can transmit between the client
                          and server is determined by the amount of available memory and the
                          size of the communications buffers. You can change the message buffer
                          size by changing the value of the max_allowed_packet
                          variable, but you must do so for both the server and your client
                          program. For example, both mysql
                          and mysqldump
                          enable you to change the client-side max_allowed_packet
                          value. See Section 5.1.1, “Configuring the Server”, Section 4.5.1, “mysql —
                          The MySQL Command-Line Tool”, and Section
                          4.5.4, “mysqldump — A Database Backup Program”. You may also want to compare the packet sizes and the size of the data objects you are
                          storing with the storage requirements, see Section
                          11.8, “Data Type Storage Requirements”


                        Each BLOB or TEXT value is represented internally by a separately allocated object. This is in contrast to all other data types, for which storage is allocated once per column when the table is opened.



                        In some cases, it may be desirable to store binary data such as media files in BLOB or TEXT columns. You may find MySQL's string handling functions useful for working with such data. See Section 12.5, “String Functions”. For security and other reasons, it is usually preferable to do so using application code rather than giving application users the FILE privilege.






                        share|improve this answer




























                          0












                          0








                          0








                          does it not really impact the database size and query performance.




                          As per MySQL documentation The BLOB and TEXT Types In most respects, you can regard a BLOB column as a VARBINARY column that can be as large as you like. Similarly, you can regard a TEXT column as a VARCHAR column. BLOB and TEXT differ from VARBINARY and VARCHAR in the following ways:




                          • For indexes on BLOB and TEXT columns, you must specify an index
                            prefix length. For CHAR and VARCHAR, a prefix length is optional. See

                            Section 8.3.5, “Column Indexes”".

                          • BLOB and TEXT columns cannot have DEFAULT values

                          • Instances of BLOB or TEXT columns in the result of a query that is
                            processed using a temporary table causes the server to use a table on
                            disk rather than in memory because the MEMORY storage engine does not
                            support those data types (see
                            Section 8.4.4, “Internal Temporary Table Use in MySQL”). Use of
                            disk incurs a performance penalty, so include BLOB or TEXT columns in
                            the query result only if they are really needed. For example, avoid
                            using SELECT
                            *, which selects all columns.

                          • The maximum size of a BLOB or TEXT object is determined by its type,
                            but the largest value you actually can transmit between the client
                            and server is determined by the amount of available memory and the
                            size of the communications buffers. You can change the message buffer
                            size by changing the value of the max_allowed_packet
                            variable, but you must do so for both the server and your client
                            program. For example, both mysql
                            and mysqldump
                            enable you to change the client-side max_allowed_packet
                            value. See Section 5.1.1, “Configuring the Server”, Section 4.5.1, “mysql —
                            The MySQL Command-Line Tool”, and Section
                            4.5.4, “mysqldump — A Database Backup Program”. You may also want to compare the packet sizes and the size of the data objects you are
                            storing with the storage requirements, see Section
                            11.8, “Data Type Storage Requirements”


                          Each BLOB or TEXT value is represented internally by a separately allocated object. This is in contrast to all other data types, for which storage is allocated once per column when the table is opened.



                          In some cases, it may be desirable to store binary data such as media files in BLOB or TEXT columns. You may find MySQL's string handling functions useful for working with such data. See Section 12.5, “String Functions”. For security and other reasons, it is usually preferable to do so using application code rather than giving application users the FILE privilege.






                          share|improve this answer
















                          does it not really impact the database size and query performance.




                          As per MySQL documentation The BLOB and TEXT Types In most respects, you can regard a BLOB column as a VARBINARY column that can be as large as you like. Similarly, you can regard a TEXT column as a VARCHAR column. BLOB and TEXT differ from VARBINARY and VARCHAR in the following ways:




                          • For indexes on BLOB and TEXT columns, you must specify an index
                            prefix length. For CHAR and VARCHAR, a prefix length is optional. See

                            Section 8.3.5, “Column Indexes”".

                          • BLOB and TEXT columns cannot have DEFAULT values

                          • Instances of BLOB or TEXT columns in the result of a query that is
                            processed using a temporary table causes the server to use a table on
                            disk rather than in memory because the MEMORY storage engine does not
                            support those data types (see
                            Section 8.4.4, “Internal Temporary Table Use in MySQL”). Use of
                            disk incurs a performance penalty, so include BLOB or TEXT columns in
                            the query result only if they are really needed. For example, avoid
                            using SELECT
                            *, which selects all columns.

                          • The maximum size of a BLOB or TEXT object is determined by its type,
                            but the largest value you actually can transmit between the client
                            and server is determined by the amount of available memory and the
                            size of the communications buffers. You can change the message buffer
                            size by changing the value of the max_allowed_packet
                            variable, but you must do so for both the server and your client
                            program. For example, both mysql
                            and mysqldump
                            enable you to change the client-side max_allowed_packet
                            value. See Section 5.1.1, “Configuring the Server”, Section 4.5.1, “mysql —
                            The MySQL Command-Line Tool”, and Section
                            4.5.4, “mysqldump — A Database Backup Program”. You may also want to compare the packet sizes and the size of the data objects you are
                            storing with the storage requirements, see Section
                            11.8, “Data Type Storage Requirements”


                          Each BLOB or TEXT value is represented internally by a separately allocated object. This is in contrast to all other data types, for which storage is allocated once per column when the table is opened.



                          In some cases, it may be desirable to store binary data such as media files in BLOB or TEXT columns. You may find MySQL's string handling functions useful for working with such data. See Section 12.5, “String Functions”. For security and other reasons, it is usually preferable to do so using application code rather than giving application users the FILE privilege.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Nov 6 '18 at 8:23

























                          answered Nov 6 '18 at 8:17









                          Md Haidar Ali KhanMd Haidar Ali Khan

                          3,69462342




                          3,69462342






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Database Administrators Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f221886%2fblob-or-varbinary-to-store-simple-strings-that-are-converted-into-byte%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Szabolcs (Ungheria) Altri progetti | Menu di navigazione48°10′14.56″N 21°29′33.14″E /...

                              Discografia di Klaus Schulze Indice Album in studio | Album dal vivo | Singoli | Antologie | Colonne...

                              How to make inet_server_addr() return localhost in spite of ::1/128RETURN NEXT in Postgres FunctionConnect to...