pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Emi Lu <emilu@encs.concordia.ca>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Which update action quicker?
Date: Tue, 23 Sep 2014 16:37:15 -0400
Message-ID: <5421D9FB.2030008@encs.concordia.ca> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-text-flowed" style="font-size: 18px;"
      lang="x-western"><small>Hello list,
        <br>
        <br>
        For a big table with more than 1,000,000 records, may I know
        which update is quicker please?
        <br>
        <br>
        (1) update t1
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set c1 = a.c1
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from a
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where pk and
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t1.c1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;&gt; a.c1;
        <br>
        &nbsp;......
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; update t1
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set c_N = a.c_N
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from a
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where pk and
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t1.c_N&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;&gt; a.c_N;
        <br>
        <br>
        <br>
        (2)&nbsp; update t1
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set c1 = a.c1 ,
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c2&nbsp; = a.c2,
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c_N = a.c_N
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp; from a
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp; where pk AND
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (&nbsp; t1.c1 &lt;&gt; a.c1 OR t1.c2 &lt;&gt;
        a.c2..... t1.c_N &lt;&gt; a.c_N)
        <br>
        <br>
        <br>
        Or other quicker way for update action?
        <br>
        <br>
        Thank you
        <br>
        Emi
      </small><br>
    </div>
  </body>
</html>




view thread (3+ messages)  latest in thread

Message-ID: <5421D9FB.2030008@encs.concordia.ca>
Permalink:  ../5421D9FB.2030008@encs.concordia.ca/
Also on:    postgresql.org/message-id/5421D9FB.2030008@encs.concordia.ca

 · 

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: emilu@encs.concordia.ca
  Subject: Re: Which update action quicker?
  In-Reply-To: <5421D9FB.2030008@encs.concordia.ca>

* 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