Re: Can this be indexed?

From: "Net Virtual Mailing Lists" <mailinglists(at)net-virtual(dot)com>
To: "Matteo Beccati" <pgsql-general(at)postgresql(dot)org>>
Subject: Re: Can this be indexed?
Date: 2004-11-06 15:49:04
Message-ID: 20041106154904.10628@mail.net-virtual.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am not clear how to use a trigger for this, I will need to look into
that....

It is my understanding that Postgres does not have materialized views
though (which I believe would solve this problem nicely) - am I mistaken?...

- Greg

>Net Virtual Mailing Lists wrote:
>> Is there a way to create an index that would make this query be efficient
>> and not perform a sequential scan?
>>
>> SELECT count(*) AS count,id FROM sometable GROUP BY id;
>
>Indexes cannot be used for retrieving results...
>
>
>> .. I've considered creating a rule on this table which would put the
>> results of this into another table anytime it is updated, but I thought
>> there might be an easier way.
>
>I don't think that a rule could come useful in this case. IMHO you could
>use triggers or a materialized view to store the results and speed up
>things.
>
>
>Best regards
>--
>Matteo Beccati
>http://phpadsnew.com/
>http://phppgads.com/
>

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ed L. 2004-11-06 16:30:30 Re: Can this be indexed?
Previous Message Alvaro Herrera Munoz 2004-11-06 15:27:15 Re: Gborg down?