E
E
Eugene2019-02-19 17:34:32
MySQL
Eugene, 2019-02-19 17:34:32

Translating tinyInt data into a single text (json) field?

Tell me this moment, in the main table there are quite a lot of fields with the tinyInt type, which are mostly responsible for storing boolean. Neither sampling nor filtering by these fields occurs when working with data (they are used only when working directly with a string).
How efficient will it be (in terms of database size) and is it generally reasonable to store all these tinyInt fields in one text field in JSON format. Since I do not use this data in queries, etc.?
How to find out what will weigh less than one filling of the text field or 20 tinyInt (1). There are almost 1 million entries already.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2019-02-19
@Rsa97

If no selection (WHERE, JOIN, GROUP BY, etc.) is carried out on these fields, then it is most compact to store boolean values ​​in the form of SET. In this case, 64 values ​​will take 8 bytes, 20 values ​​- 4 bytes.

M
Moses Fender, 2019-02-19
@mosesfender

If these are booleans, then it is better to store them in the form of Integer and use bitwise operations to use them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question