I
I
Ilya Bobkov2019-10-28 10:30:35
SQL
Ilya Bobkov, 2019-10-28 10:30:35

NULL in database fields, is it necessary?

Good day!
I read in one of the articles that using NULL in field values ​​slows down performance. How true is this?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
I
ittakir, 2019-10-28
@ittakir

I think the answer depends very much on the DB you are using. Take and measure.
But, I think that the difference is extremely insignificant and will be overlapped many times over by the disk cache, query optimization, non-optimal data storage scheme, etc.

A
Adamos, 2019-10-28
@Adamos

You have a stupid question under the right heading.
You either need NULL fields or you don't.
If needed, this theoretical deceleration will still be more effective than most bikes you can replace it with.
If not, why use them?

A
Andrey, 2019-10-28
@VladimirAndreev

What's the difference?
for example, do you have any measurements, anything. it can be int if the measurement succeeded, or null if the measurement failed. and 0 is a perfectly valid value..
so you either need to allow null or you don't..

G
Godless, 2019-10-28
@Godless

IMHO, NULL is a useful thing. Yes, they should be taken into account. But you yourself design the database and write queries - check the performance.

D
d-stream, 2019-10-31
@d-stream

Multiplication is a more expensive operation than addition. But that's no reason to use addition instead of multiplication. In general, to paraphrase Professor Preobrazhensky, one should not read such articles.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question