Comments on: Common wrong Data Types compilation https://shlomi-noach.github.io/blog/mysql/common-data-types-errors-compilation Blog by Shlomi Noach Tue, 17 Jul 2012 05:58:25 +0000 hourly 1 https://wordpress.org/?v=5.3.3 By: shlomi https://shlomi-noach.github.io/blog/mysql/common-data-types-errors-compilation/comment-page-1#comment-107741 Tue, 17 Jul 2012 05:58:25 +0000 https://shlomi-noach.github.io/blog/?p=85#comment-107741 @rob,
A binary(16) requires less storage. The CPU overhead is nowadays neglectable.

]]>
By: rob https://shlomi-noach.github.io/blog/mysql/common-data-types-errors-compilation/comment-page-1#comment-107670 Mon, 16 Jul 2012 20:27:17 +0000 https://shlomi-noach.github.io/blog/?p=85#comment-107670 Very helpful info…

In the case of a 32-bit hexadecimal value (UUID), what’s the advantage of binary(16) versus char(32)? If you have to use unhex() and hex() calls everytime you read or write the values, would that overhead make char(32) perform better?

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/common-data-types-errors-compilation/comment-page-1#comment-84650 Mon, 16 Apr 2012 08:17:31 +0000 https://shlomi-noach.github.io/blog/?p=85#comment-84650 @Danilo,
See: Choosing MySQL boolean data types.
There are good insights in the user comments on that post.
Basically – BIT(1) is not a good option.

]]>
By: danilo https://shlomi-noach.github.io/blog/mysql/common-data-types-errors-compilation/comment-page-1#comment-84642 Mon, 16 Apr 2012 07:38:30 +0000 https://shlomi-noach.github.io/blog/?p=85#comment-84642 Hi, very interesting blog!
I would ask: how about BIT(1) to store boolean value, for example for field as ‘active’, that can be true or false?

Btw, thanks for this great post!
danilo

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/common-data-types-errors-compilation/comment-page-1#comment-2717 Mon, 20 Jul 2009 06:52:27 +0000 https://shlomi-noach.github.io/blog/?p=85#comment-2717 Hi Ann,

Thanks for sharing your experience.
In two customer cases I’ve had, and in which we’ve changed data types throughout the schema, we’ve reached 50% savings in disk space, just due to proper data types + charsets.
I personally see this as basic and important part for auditing.

Obviously, there are other parameters to consider. But I think laying out the basics properly, gives boost to further steps.

Regards.
Shlomi

]]>
By: annie https://shlomi-noach.github.io/blog/mysql/common-data-types-errors-compilation/comment-page-1#comment-2685 Thu, 16 Jul 2009 19:31:05 +0000 https://shlomi-noach.github.io/blog/?p=85#comment-2685 Hi,

In my experience having smallint vs int was more to save space but does not necessarily influence performance at least not something noticeable. Many times I come across some white papers where people are trying to prove a point, I run the test and the method they are trying to prove wrong has better performance than the one they are in favor. I have done such test even with the white paper coming out of the company that created the software.

Most of the time, the approach to design / architect databases or application depends on what you are trying to accomplish and what kind of usage the system will be for. Doing consulting for many many years, I’ve come across multiple approaches and styles and if sit down and analyze each one of them they all would have valid justification for their approach or design. It is funny but the more experienced I’ve gotten the less adamant and less critical I have become. This does not mean that I am in favor of carelessness and the obvious.

Thanks,

Ann

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/common-data-types-errors-compilation/comment-page-1#comment-2683 Thu, 16 Jul 2009 17:15:15 +0000 https://shlomi-noach.github.io/blog/?p=85#comment-2683 Hi Ann,

Not really 🙂
I stand corrected on hexadecimal values;
IPv4 is still *very much* widespread;
MEDIUMINT is undesired on InnoDB.

The arguments are still very much valid. Not as starting point, but as start-to-end argument.

(Though I am very much susceptible to error and will gladly stand corrected on any point I make)

Regards

]]>
By: annie https://shlomi-noach.github.io/blog/mysql/common-data-types-errors-compilation/comment-page-1#comment-2682 Thu, 16 Jul 2009 16:28:28 +0000 https://shlomi-noach.github.io/blog/?p=85#comment-2682 It seems that all the original arguments from shlomi where
refuted. When it comes to IT if you have 5 people you most likely end up with 7 opinions!!! However the recommendation are still valid for a starting point the rest is preference.

Ann

]]>
By: Designing relational databases for PHP in MySQL | The Struggle https://shlomi-noach.github.io/blog/mysql/common-data-types-errors-compilation/comment-page-1#comment-2667 Wed, 15 Jul 2009 14:34:40 +0000 https://shlomi-noach.github.io/blog/?p=85#comment-2667 […] choosing the wrong data type […]

]]>
By: Garrett W. https://shlomi-noach.github.io/blog/mysql/common-data-types-errors-compilation/comment-page-1#comment-2071 Mon, 25 May 2009 19:48:02 +0000 https://shlomi-noach.github.io/blog/?p=85#comment-2071 The only thing about storing the MD5s as binary is that you have to remember to do the HEX()/UNHEX() to use them as text in your application – a minor difficulty for sure, but an invitation for unintentional programming bugs.

Maybe.

]]>