"Sgarbossa Domenico" writes:
> I guess the right query is:
> select distinct on (articolo) articolo,data_ent,prezzo from
> listini_anagrafici order by articolo, data_ent desc
> but it seems that this query runs slowly... about 5/6 seconds.
> I've tried adding this index
> CREATE INDEX articol
The index can produce the sorted output. Add a dummy WHERE clause like
articoli > and data_ent > .
--Imad
On Mon, Sep 28, 2009 at 10:18 PM, Sgarbossa Domenico
wrote:
>
> I need to retrieve the most recent prices per products from a price list
> table:
>
> CREATE TABLE listini_anagrafici
> (
>
I need to retrieve the most recent prices per products from a price list table:
CREATE TABLE listini_anagrafici
(
id character varying(36) NOT NULL,
articolo character varying(18),
listino character varying(5),
data_ent date,
data_fin date,
prezzo double precision,
ultimo boolean DE
the parts
updated can allow a client application to merge the updates with a previous
full result client side.
On 9/29/09 5:44 AM, "Sgarbossa Domenico"
wrote:
> Subject: Re: [PERFORM] Performance problems with DISTINCT ON
>
>
>> Sgarbossa Domenico wrote:
>>>
> Should I try a different approach to solve this issue?
Yes. Ask yourself if you *really* need 180k rows.
Best regards,
depesz
--
Linkedin: http://www.linkedin.com/in/depesz / blog: http://www.depesz.com/
jid/gtalk: dep...@depesz.com / aim:depeszhdl / skype:depesz_hdl / gg:6749007
--
Sent
Subject: Re: [PERFORM] Performance problems with DISTINCT ON
Sgarbossa Domenico wrote:
I need to retrieve the most recent prices per products from a price list
table:
select distinct on (articolo) articolo,data_ent,prezzo from
listini_anagrafici order by articolo, data_ent desc
but it
Sgarbossa Domenico wrote:
> I need to retrieve the most recent prices per products from a price list
> table:
> select distinct on (articolo) articolo,data_ent,prezzo from
> listini_anagrafici order by articolo, data_ent desc
>
> but it seems that this query runs slowly... about 5/6 seconds.
>
I need to retrieve the most recent prices per products from a price list table:
CREATE TABLE listini_anagrafici
(
id character varying(36) NOT NULL,
articolo character varying(18),
listino character varying(5),
data_ent date,
data_fin date,
prezzo double precision,
ultimo boolean DE