Re: [PERFORM] Performance problems with DISTINCT ON

2009-10-03 Thread Tom Lane
"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

Re: [PERFORM] Performance problems with DISTINCT ON

2009-10-03 Thread imad
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 > ( >

[PERFORM] Performance problems with DISTINCT ON

2009-10-03 Thread Sgarbossa Domenico
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

Re: [PERFORM] Performance problems with DISTINCT ON

2009-09-29 Thread Scott Carey
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: >>>

Re: [PERFORM] Performance problems with DISTINCT ON

2009-09-29 Thread hubert depesz lubaczewski
> 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

Re: [PERFORM] Performance problems with DISTINCT ON

2009-09-29 Thread Sgarbossa Domenico
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

Re: [PERFORM] Performance problems with DISTINCT ON

2009-09-29 Thread Richard Huxton
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. >

[PERFORM] Performance problems with DISTINCT ON

2009-09-28 Thread Sgarbossa Domenico
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