Search Postgresql Archives

Re: querying both text and non-text properties

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Dec 4, 2018, at 4:59 PM, Laurenz Albe <laurenz.albe@xxxxxxxxxxx> wrote:
> 
> You have two options:
> 
> A combined index:
> 
>  CREATE EXTENSION btree_gin;
>  CREATE INDEX ON fulltext USING gin (to_tsvector('english', doc), color);
> 
> That is the perfect match for a query with
> 
>  WHERE color = 'red' AND to_tsvector('german', doc) @@ to_tsquery('english', 'word');
> 
> But you can also create two indexes:
> 
>  CREATE INDEX ON fulltext USING gin (to_tsvector('english', doc));
>  CREATE INDEX ON fulltext (color);
> 
> Then you don't need the extension, and PostgreSQL can still use them for the search,
> either only one of them if the condition is selective enough, or a "BitmapAnd" of both.

Thanks! I will try both these methods and compare the performance.

Rob




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux