Re: Is there a point to having both a normal gist index and an exclude index?

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Rob Sargent <robjsargent(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Is there a point to having both a normal gist index and an exclude index?
Date: 2017-04-05 18:20:37
Message-ID: 20170405182037.GA9174@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Apr 05, 2017 at 12:11:09 -0600,
Rob Sargent <robjsargent(at)gmail(dot)com> wrote:
>
>
>On 04/05/2017 12:04 PM, Bruno Wolff III wrote:
>>On Wed, Apr 05, 2017 at 00:05:31 -0400,
>> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>>Bruno Wolff III <bruno(at)wolff(dot)to> writes:
>>>>... I create both a normal gist index and an exclude index using the
>>>>following:
>>>>CREATE INDEX contains ON iplocation USING gist (network inet_ops);
>>>>ALTER TABLE iplocation
>>>> ADD CONSTRAINT overlap EXCLUDE USING gist (network inet_ops WITH &&);
>>>
>>>>But I am wondering if it is useful to have the normal gist index for
>>>>finding netblocks containing a specific IP address, as it seems
>>>>like the
>>>>exclude index should be usable for that as well.
>>>
>>>No, that manually-created index is completely redundant with the
>>>constraint index.
>>
>>Thanks.
>>
>>P.S. Using spgist with version 10 for the exclude index is much
>>faster than using gist in 9.6. I have run the index creation for as
>>long as 6 hours and it hasn't completed with 9.6. It took less than
>>10 minutes to create it in 10. For this project using 10 isn't a
>>problem and I'll be doing that.
>>
>>
>That's an incredible difference. Is it believable? Same resource, etc?

Same data, same load scripts other than spgist replacing gist and pointing
to the 10 server instead of the 9.6 server.

If gist is scaling at n^2 because of bad splits, then with 3.5M records
I could see that big of a difference if spgist is n log n. I don't know for
sure if that was what is really going on. The index creation seems to
be CPU bound rather than I/O bound as it is pegging a CPU.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message George Neuner 2017-04-05 18:30:41 Re: browser interface to forums please?
Previous Message Adrian Klaver 2017-04-05 18:14:01 Re: browser interface to forums please?