Re: count(*), EXISTS, indexes - Mailing list pgsql-sql

From Itai Zukerman
Subject Re: count(*), EXISTS, indexes
Date
Msg-id 87he94r8ua.fsf@matt.w80.math-hat.com
Whole thread Raw
In response to Re: count(*), EXISTS, indexes  (Josh Berkus <josh@agliodbs.com>)
Responses Re: count(*), EXISTS, indexes  (Josh Berkus <josh@agliodbs.com>)
List pgsql-sql
>>   # explain select sum(weight) from rprofile rp where exists (select 1 from 
> rcount_prof rcp where rcp.profile ~<= rp.profile and ~rcp.psig ~<= rp.psig 
> and rcp.filter='{734,1944}');
>
> I'm not familiar with the "~" that you have in the query.  What are those for?

They are my own operators and functions.  profile is a integer array
and the ~'s are subset operators.  psig is a bit signature, "~" is
complement, and the ~ operators again are subset operators.

> Do you have an index on rcp.profile, rcp.psig, rcp.filter?

Yes, yes, and yes.  ATM, though, there are only about 50 rows in
rcount_prof.  The vast majority of time is spent scanning the
600,000-row rprofile table.

-- 
Itai Zukerman  <http://www.math-hat.com/~zukerman/>



pgsql-sql by date:

Previous
From: Josh Berkus
Date:
Subject: Re: count(*), EXISTS, indexes
Next
From: Itai Zukerman
Date:
Subject: SELECT INTO TEMP in Trigger?