pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Guillaume Cottenceau <gc@mnc.ch>
To: Michael Lewis <mlewis@entrata.com>
Cc: postgres performance list <pgsql-performance@postgresql.org>
Subject: Re: much slower query in production
Date: Wed, 26 Feb 2020 20:37:48 +0100
Message-ID: <87o8tlm96b.fsf@mnc.ch> (raw)
In-Reply-To: <CAHOFxGp9K3LHR8ejzDvMyNNv9WmpyyA6CvctZGTeh3iJ38kcwg@mail.gmail.com>
References: <878skpnx0u.fsf@mnc.ch>
	<20200226162809.GZ31889@telsasoft.com>
	<CAHOFxGrEX4FGV=uEtzWdS-MNgh4t5U139TJKPwYFFLfWcBrEfA@mail.gmail.com>
	<87sgixmdil.fsf@mnc.ch>
	<CAHOFxGp9K3LHR8ejzDvMyNNv9WmpyyA6CvctZGTeh3iJ38kcwg@mail.gmail.com>

Michael Lewis <mlewis 'at' entrata.com> writes:

>  UPDATE multicards
>  SET defacements = COALESCE( count, 0 )
>  FROM ( SELECT multicard_uid, COUNT(*) AS count FROM tickets GROUP BY multicard_uid ) AS sub
>  WHERE uid = multicard_uid OR multicard_uid is null;
>
> I expect this should work. Not sure of performance of course.

This looked great but as it seems you suspected, it's very slow :/
I interrupted it after 5 minutes run on my dev computer.

-- 
Guillaume Cottenceau





view thread (11+ messages)  latest in thread

Message-ID: <87o8tlm96b.fsf@mnc.ch>
Permalink:  ../87o8tlm96b.fsf@mnc.ch/
Also on:    postgresql.org/message-id/87o8tlm96b.fsf@mnc.ch

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: gc@mnc.ch, mlewis@entrata.com
  Subject: Re: much slower query in production
  In-Reply-To: <87o8tlm96b.fsf@mnc.ch>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox