E
E
ericcartman2018-10-01 14:02:49
SQL
ericcartman, 2018-10-01 14:02:49

When to use a composite index on 2 fields, and when 2 indexes?

When in databases (tables) to use a composite index on 2 fields, and when 2 indexes (on the same fields, of course)?
(the number 2 is taken for simplicity)
does it depend on the type of the database?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Denis, 2018-10-11
@ericcartman

Everything is very subtle here, I recently encountered a similar problem, the results can be read here . Is it possible to speed up a query to the database (add indexes)?
My conclusion is that you need to make indexes based on possible database queries based on your business logic (i.e. there are situations when you need to make 2 indexes, when one, and when it’s better not to do it) and field types (for dates, for example there are nuances).
Well, for different databases, most likely there are moments.

A
Arthur Grand, 2018-10-11
@artygrand

An index on two fields is needed if you are looking for your result on these two fields.

S
Sergey Malovichko, 2018-10-11
@mrSerg161

This is enough for you to start
https://otus.ru/events/subd_open/136/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question