How to increase query speed without using full-text search?

This is my simple request; Search selectnothingI'm sure I won’t have any hits.

SELECT nome_t FROM myTable WHERE nome_t ILIKE '%selectnothing%';

it EXPLAIN ANALYZE VERBOSE

Seq Scan on myTable  (cost=0.00..15259.04 rows=37 width=29) (actual time=2153.061..2153.061 rows=0 loops=1)
  Output: nome_t
  Filter: (nome_t ~~* '%selectnothing%'::text)
Total runtime: 2153.116 ms

myTable has about 350 thousand rows, and the table definition is:

CREATE TABLE myTable (
    nome_t text NOT NULL,
)

I have an index on nome_t as follows:

CREATE INDEX idx_m_nome_t ON myTable
USING btree (nome_t);

Although this is certainly a good candidate for full-text search, I would now decide to exclude this option.
This request is intended to be run from a web application, and it currently takes about 2 seconds, which is clearly too much.
Is there anything I can do, for example, using other index methods to improve the speed of this query?

+3
source share
2 answers

, ILIKE '% selectnothing%' , . , .


: Wildspeed, . , .

Wildspeed GIN LIKE .

http://www.sai.msu.su/~megera/wiki/wildspeed

+4

, - nome_t myTable . ( ), ( / ).

+1

Source: https://habr.com/ru/post/1783842/


All Articles