Re: Performance issues

From: Vivekanand Joshi <vjoshi(at)zetainteractive(dot)com>
To: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Performance issues
Date: 2015-03-17 15:10:03
Message-ID: 087a57caebe1d71091670f3435d2c1e5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresql(dot)org
[mailto:pgsql-performance-owner(at)postgresql(dot)org] On Behalf Of Tomas Vondra
Sent: Tuesday, March 17, 2015 8:13 PM
To: pgsql-performance(at)postgresql(dot)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(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Vivekanand Joshi 2015-03-17 15:16:03 Re: Performance issues
Previous Message Tomas Vondra 2015-03-17 14:43:00 Re: Performance issues