Re: Large data and slow queries

From: vinny <vinny(at)xs4all(dot)nl>
To: "Martijn Tonies (Upscene Productions)" <m(dot)tonies(at)upscene(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>, pgsql-general-owner(at)postgresql(dot)org
Subject: Re: Large data and slow queries
Date: 2017-04-19 11:37:33
Message-ID: 45aacae7eeaa24e4d5559028458c3f3d@xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2017-04-19 13:25, Martijn Tonies (Upscene Productions) wrote:
> Samuel, others,
>
> Perhaps I'm missing something, but I'd be interested in the reasoning
> behind this.
>
> For column 'what', it seems you have no index on all values, only
> indices with specific values for 'what'.
>
> How does this speed up the search? Will PostgreSQL use those indices,
> instead of using a generic index on 'what' and optionally other
> columns?
>
>
> With regards,
>
> Martijn Tonies
> Upscene Productions
> http://www.upscene.com
>

That's a "partial index", it only contains records that meet the
requirements of the index definition.

https://www.postgresql.org/docs/9.5/static/indexes-partial.html

Basically; if you create an index on records where 'name = kees' then if
your query contains "where name=kees"
the planner can just load that index and know that the records in that
index will not contain
any other names, saving the need to filter for 'name=kees'

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message JP Jacoupy 2017-04-19 11:55:21 Re: Unable to upload backups
Previous Message Samuel Williams 2017-04-19 11:35:43 Re: Large data and slow queries