Re: Same condition in the CTE and in the subsequent JOIN using it

2018-04-26 Thread Alexander Farber
s/ I can trust / I can't trust /

Re: Same condition in the CTE and in the subsequent JOIN using it

2018-04-26 Thread Alexander Farber
Thank you for the insightful comments. Actually in my specific case I have managed to get rid of the (almost) same condition in the outer query: CREATE OR REPLACE FUNCTION words_stat_scores_2( in_social integer, in_sidtext ) RETURNS TABLE (

Re: Same condition in the CTE and in the subsequent JOIN using it

2018-04-25 Thread Alban Hertroys
> On 25 Apr 2018, at 17:45, Alexander Farber wrote: (…) > And here is the function source code: > > CREATE OR REPLACE FUNCTION words_stat_scores( > in_social integer, > in_sidtext > ) RETURNS TABLE ( > out_day text, >

Re: Same condition in the CTE and in the subsequent JOIN using it

2018-04-25 Thread Vincent Veyron
On Wed, 25 Apr 2018 17:45:39 +0200 Alexander Farber wrote: > WITH cte AS ( > SELECT > DATE_TRUNC('day', m.played) AS day, > m.mid, > EXTRACT(EPOCH FROM m.played - LAG(m.played) OVER > (PARTITION BY m.g

Re: Same condition in the CTE and in the subsequent JOIN using it

2018-04-25 Thread Andreas Kretschmer
Am 25.04.2018 um 17:45 schrieb Alexander Farber: Thank you for any hints, I apologize if my question is too specific and difficult to answer... i haven't checked the whole query, but where-conditions from the outer query are not pushed down into the CTE-query. First the whole CTE will be ma