Monday, March 20, 2017

[google-cloud-sql-discuss] Re: how to install extension pg_trgm (trigram) on postgresql

Hi,

The Trigram extension is a requirement for us as well, it's needed to enable the gin_trgm_ops index which significantly speeds up some of our queries:

# explain select id, name from some_table where name ~ 'foo';
                           QUERY PLAN
-----------------------------------------------------------------
 
Seq Scan on some_table  (cost=0.00..1829.67 rows=337 width=22)
   
Filter: ((name)::text ~ 'foo'::text)
(2 rows)


# create extension pg_trgm;  
# create index name_trgm_idx on some_table using gin (name gin_trgm_ops);


# explain select id, name from some_table where name ~ 'foo';
                                  QUERY PLAN
-------------------------------------------------------------------------------
 
Bitmap Heap Scan on some_table  (cost=14.62..842.99 rows=337 width=22)
   
Recheck Cond: ((name)::text ~ 'foo'::text)
   
->  Bitmap Index Scan on name_trgm_idx  (cost=0.00..14.53 rows=337 width=0)
         
Index Cond: ((name)::text ~ 'foo'::text)
(4 rows)




On Monday, 13 March 2017 17:14:26 UTC+1, Murilo Duarte wrote:
Olá, eu preciso saber se há alguma maneira de adicionar uma extensão trigrama não PostgreSQL, obtido a partir de Google Cloud SQL! Faça o seguinte comentário:

"PG :: UndefinedFile: Erro: Não foi possível arquivo de controle de extensão aberta" /share/extension/pg_trgm.control ": Nenhum arquivo ou diretório
: Cria a pg_trgm extensão;
"

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/a52c003d-761d-474a-8aca-b0a2131bbe09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment