pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: lwu@mxlogic.com
To: pgsql-admin@postgresql.org
Subject: dynamic queries vs static queries
Date: 5 Apr 2004 14:54:04 -0700
Message-ID: <559b7ab0.0404051354.5a7c8f3d@posting.google.com> (raw)

Hi,

Is there any performance difference between dynamic queries vs statis
queris in PL/pgSQL functions?

For example:

create function static_fn(int, character varying)...
  pk_id ALIAS $1;
  a_str ALIAS $2;
begin
  update a_table
  set a_column = a_str
  where pk=pk_id;
...
END;
' LANGUAGE 'plpgsql';

vs
create function dynamic_fn(int, character varying)...
  pk_id ALIAS $1;
  a_str ALIAS $2;
begin
  EXECUTE ''update a_table '' ||
    ''set a_column = '' || a_str || 
    '' where pk='' || pk_id;
...
END;
' LANGUAGE 'plpgsql';



Message-ID: <559b7ab0.0404051354.5a7c8f3d@posting.google.com>
Permalink:  ../559b7ab0.0404051354.5a7c8f3d@posting.google.com/
Also on:    postgresql.org/message-id/559b7ab0.0404051354.5a7c8f3d@posting.google.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: lwu@mxlogic.com
  Subject: Re: dynamic queries vs static queries
  In-Reply-To: <559b7ab0.0404051354.5a7c8f3d@posting.google.com>
  References: <559b7ab0.0404051354.5a7c8f3d@posting.google.com>

* 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