Re: Performance issues - Mailing list pgsql-performance

From Vivekanand Joshi
Subject Re: Performance issues
Date
Msg-id 087a57caebe1d71091670f3435d2c1e5@mail.gmail.com
Whole thread Raw
In response to Re: Performance issues  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Responses Re: Performance issues  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-performance
The confusion for me here is that :


I am getting results from the view in around 3 seconds
(S_V_D_CAMPAIGN_HIERARCHY) and 25 seconds (S_V_F_PROMOTION_HISTORY_EMAIL)

But when I am using these two views in the query as the joining tables, it
doesn't give any result.  As per my understanding, the planner is making new
plan and that is costly instead of using output from the view, which is
actually understandable.

Is there a way, we can do anything about it?

I hope I am making some sense here.

Regards,
Vivek

-----Original Message-----
From: pgsql-performance-owner@postgresql.org
[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Tomas Vondra
Sent: Tuesday, March 17, 2015 8:13 PM
To: pgsql-performance@postgresql.org
Subject: Re: [PERFORM] Performance issues

On 17.3.2015 15:19, Thomas Kellerer wrote:
> Tomas Vondra schrieb am 17.03.2015 um 14:55:
>>  (2) using window functions, e.g. like this:
>>
>>      SELECT * FROM (
>>        SELECT *,
>>             ROW_NUMBER() OVER (PARTITION BY touchpoint_execution_id
>>                                ORDER BY FROM max_creation_dt) AS rn
>>        FROM s_f_touchpoint_execution_status_history
>>      ) foo WHERE rn = 1
>>
>>      But estimating this is also rather difficult ...
>
>
> From my experience rewriting something like the above using DISTINCT
> ON is usually faster.

How do you get the last record (with respect to a timestamp column) using a
DISTINCT ON?


--
Tomas Vondra                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


pgsql-performance by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Performance issues
Next
From: Vivekanand Joshi
Date:
Subject: Re: Performance issues