O
O
Oleg Petrov2017-10-24 16:17:12
PostgreSQL
Oleg Petrov, 2017-10-24 16:17:12

How to speed up query to database in Postgres sql format?

There is a database of more than 100 million lines, you need to make queries to it throughout the database.
How is it possible to speed up requests?
I was advised to index the database.
Can you tell me the best way to make it? Point by point, if possible.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Cheremisin, 2017-10-24
@Smeilz1

It all depends a lot on the content (data organization) of your tables and the queries you make on them. Usually, indexes are built on those fields that are involved in the main queries. The most important thing here is not to overdo it and not create too many indexes, otherwise the insert will slow down.
Indexes are immediately created by primary/secondary keys.
To analyze the database, do explain your requests - https://habrahabr.ru/post/203320/
Well, if there are a lot of requests like LIKE, then it makes sense to index your data in search engines like elasticsearch.

A
Alexander Aksentiev, 2017-10-24
@Sanasol

tatiyants.com/postgres-query-plan-visualization
tatiyants.com/pev/#/plans

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question