Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1afqfn-0005p6-PV for pgsql-bugs@arkaria.postgresql.org; Tue, 15 Mar 2016 15:14:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1afqfn-0003Ix-CA for pgsql-bugs@arkaria.postgresql.org; Tue, 15 Mar 2016 15:14:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1afqfA-0002bo-7G for pgsql-bugs@postgresql.org; Tue, 15 Mar 2016 15:13:36 +0000 Received: from mail-ob0-x235.google.com ([2607:f8b0:4003:c01::235]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1afqf6-0000kz-RG for pgsql-bugs@postgresql.org; Tue, 15 Mar 2016 15:13:35 +0000 Received: by mail-ob0-x235.google.com with SMTP id ts10so20360193obc.1 for ; Tue, 15 Mar 2016 08:13:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=4zxyLsBouFwUU8ZTH7ZmaBy2KqAfxi9Y4hIbMGbWKco=; b=WQHRs2jkc7X5BPqMlL4Dpuwng8yOIyOqphPzeA/4ZVONPy0RMLH9dGJIxJMuN6chKH ToofWgCmkWJ+NLCjkheqCunOUvJCjEB+ZPAFU7LUdaxZ3i466ssvE+FKt+KI4rkK+sqD 1V/fyfan+Ms+rPArh4yzrpiV6DHdnDAiLgym5ptUKcWc3LR6QHZI355WS2wTVjjGqPVr s8YrXB2W/HrphKMR1iFDx3RlZPVlKLbxPwkZfWMkKe4XSg9IN8yyRNiDIYJgZG4qAkQw Qaqq5l8WTJXND7ddKxGMzeFutJHS7FKR8IAnlVEWk8a78Jsy8X0YqXnGkDUPcATTuAgU xSVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=4zxyLsBouFwUU8ZTH7ZmaBy2KqAfxi9Y4hIbMGbWKco=; b=go9vGNuaarMf64529KeeKjL994e0Ofad5CvcL6U/ai/gtOodSz4CwIbWe4FUoKVQNF yE5OLPybzg/KiF6cVbg8GZ0IfdIsyzLF4SyCrJbFr8K0q+zoGIeC2zKn+JG1DznN0D9j EPiEqZ4n/jomsDjHgIbwsklaODuJd6G+v+JBKqxa/uA6xbpkIais6HqstEtu58TstqZj yNvsce1mH3nKRSmtLyOwP3tWokUKfHIkEjkxjXswI+DtsAzl7Jp9FEhdJm7wrtAi5FGJ +NQkERCx6U+FT8iLG2BaAhSmmKk/sLReDeWQX91S3BPARm6qDQy0fEfHUkrRv0q7Wsxo 7VaQ== X-Gm-Message-State: AD7BkJJ8rhJmj8nCAwx/+RTA6p30lCbV6WfWpC5ccyYfXiRSVyMJMpdZ2HDhVrEqP7CAFe/F7b2Jm3vMrp1HpQ== MIME-Version: 1.0 X-Received: by 10.60.173.10 with SMTP id bg10mr18800149oec.32.1458054811275; Tue, 15 Mar 2016 08:13:31 -0700 (PDT) Received: by 10.157.44.183 with HTTP; Tue, 15 Mar 2016 08:13:31 -0700 (PDT) In-Reply-To: <5BD57C5B-14E8-4472-96B5-EB5CBB35854F@gmail.com> References: <20160314204348.8902.26168@wrigleys.postgresql.org> <926E6EDE-8959-4209-B3F0-E894987FD4E0@gmail.com> <5BD57C5B-14E8-4472-96B5-EB5CBB35854F@gmail.com> Date: Tue, 15 Mar 2016 08:13:31 -0700 Message-ID: Subject: Re: BUG #14020: row_number() over(partition by order by) - weird behavior From: "David G. Johnston" To: Boyko Yordanov Cc: "pgsql-bugs@postgresql.org" Content-Type: multipart/alternative; boundary=047d7bd74e4e16dc43052e17d762 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --047d7bd74e4e16dc43052e17d762 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Mar 15, 2016 at 2:04 AM, Boyko Yordanov wrote: > Thinking further on this, I now got your point on the =E2=80=9Cduplicate > grossprices is ordered randomly=E2=80=9D suggestion. > > What I missed to realize is that the update query updates *every* product > partition that has reordered due to duplicate grossprice being ordered > randomly, resulting in thousands of updates instead of just < 148 (or < 9= 9 > in the case of product =3D 2 partition). > > Is there a way to ensure persistence of =E2=80=9Cover(order by duplicate_= columns)=E2=80=9D > ordering, except for ordering by a second (or even third) column? > > =E2=80=8BNo, you need to have enough columns for deterministic order. Dave =E2=80=8B --047d7bd74e4e16dc43052e17d762 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Tue, Ma= r 15, 2016 at 2:04 AM, Boyko Yordanov <b.yordanov2@gmail.com> wrote:
Thinking further on this, I now got your point on the =E2= =80=9Cduplicate grossprices is ordered randomly=E2=80=9D suggestion.
What I missed to realize is that the update query updates *every* pr= oduct partition that has reordered due to duplicate grossprice being ordere= d randomly, resulting in thousands of updates instead of just < 148 (or = < 99 in the case of product =3D 2 partition).=C2=A0

=
Is there a way to ensure persistence of =E2=80=9Cover(order by duplica= te_columns)=E2=80=9D ordering, except for ordering by a second (or even thi= rd) column?


=E2=80=8BNo, you need to have enough columns for determ= inistic order.

Dave
=E2=80=8B
=C2=A0
--047d7bd74e4e16dc43052e17d762--