S
S
Sergey2011-09-16 19:15:50
MySQL
Sergey, 2011-09-16 19:15:50

EAV and data type selection

Actually I'm just curious. At the moment, one of the projects needed a universal storage of parameters for parts of the system. It can be both numbers and healthy texts. Because while they are stored in long text. the question actually is, is it possible to somehow store these parameters in a more convenient way, because something tells me that if out of 1000 records only one stores healthy text, then the remaining 999 create an unnecessary load ...

In fact, the question can be reformulated as “But it’s not harmful can LONG TEXT store small string values"?

ps Search in these fields is not planned. But it would be nice to explain in the case of a search by these parameters. Can eat more competent way to store such data?

pps MySQL + InnoDB

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kocherman, 2011-09-16
@kocherman

There is no difference in storing long and short data in long text.
In this case, there will be no extra load

S
Scissors, 2011-09-16
@Scissors

You can organize the structure like this:
Eav
=================
id
type
Eav_type_int
================
id
eav_id
value (int)
Eav_type_string
=================
id
eav_id
value (string)
depending on the record type, put the data into the required table.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question