From: | Pradeep Kumar <pradeep(dot)kumar(dot)pc(at)gmail(dot)com> |
---|---|
To: | Olivier Leprêtre <o(dot)lepretre(at)gmail(dot)com> |
Cc: | pgsql-admin <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: filter partitions |
Date: | 2018-02-16 05:54:28 |
Message-ID: | CAGsUxCyFE_gQ8OsXERbYabCfY=qe293BAs3uvH2Wfvcx+x3YaQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
select p, max(item) over (partition by p) from item where item='D'
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Tue, Feb 13, 2018 at 8:37 PM, Olivier Leprêtre <o(dot)lepretre(at)gmail(dot)com>
wrote:
> Hi,
>
>
>
> I wonder how could it be possible to extract partitions that contains a
> peculiar item
>
>
>
> Consider 4 partitions 1, 2, 3, 4 with different items A, B, C... inside
>
>
>
> P item
>
> 1 A
>
> 1 B
>
> 1 C
>
> 2 B
>
> *2 D*
>
> 2 G
>
> 2 H
>
> 3 B
>
> 3 C
>
> 4 X
>
> *4 D*
>
> 4 Z
>
>
>
>
>
> How could a select return partitions 2,4 because they both contains D item
> ?
>
>
>
> As a result, I would get :
>
>
>
> 2 B
>
> 2 D
>
> 2 G
>
> 2 H
>
> 4 X
>
> 4 D
>
> 4 Z
>
>
>
> I can filter partitions with lag, lead, nth_value... but how could I write
> something like "select P,any (item=D) over (partition by P) from..."
>
>
>
> Thanks for any help,
>
>
>
>
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> Garanti
> sans virus. www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
> <#m_7873526533910504703_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
--
Pradeep
From | Date | Subject | |
---|---|---|---|
Next Message | Azimuddin Mohammed | 2018-02-16 05:54:43 | postgres started without auto vaccum |
Previous Message | Laurenz Albe | 2018-02-16 05:00:04 | Re: postgres not starting |