G
G
ganbatte2020-04-15 05:16:27
MySQL
ganbatte, 2020-04-15 05:16:27

Is it possible to create an index for a column only for null, or only for non-null?

When you create an index for a column, a new table for indexes is created and the database grows. I need to index only values ​​with null data. To search for 'where column = null'. This will make the database a little smaller than if the contents of the value were not null.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2020-04-15
@ganbatte

it doesn't happen, make two tables then

M
Melkij, 2020-04-15
@melkij

When you create an index for a column, a new table is created for the indexes

This is not a table.
To search for 'where column = null'.

This condition does not require an index or even data. By definition, an empty sample at the parser stage.
If we are talking about where column is null - this happens in principle, a partial index is called. But mysql still can't do that.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question