pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Philip Warner <pjw@rhyme.com.au>
To: Ang Chin Han <angch@pintoo.com>
To: pgsql-sql@postgresql.org
Subject: Re: Functions too slow, even with iscachable?
Date: Mon, 07 Aug 2000 22:12:38 +1000
Message-ID: <3.0.5.32.20000807221238.0277eb30@mail.rhyme.com.au> (raw )
At 17:11 7/08/00 +0800, Ang Chin Han wrote:
>
>BTW, pg_dump doesn't seem to preserve the iscachable attribute. Bug?
>
Here is a patch for 7.0.2 sources which adds support for ischachable to
pg_dump.
-------------------------------------------------
inline patch 1: zzz/pg_dump.c, zzz/pg_dump.h (+14/-2 lines) download inline-1.patch diff -Naur pg_dump/pg_dump.c zzz/pg_dump.c
--- pg_dump/pg_dump.c Fri Apr 14 11:34:24 2000
+++ zzz/pg_dump.c Mon Aug 7 21:51:21 2000
@@ -1456,13 +1456,15 @@
int i_proretset;
int i_prosrc;
int i_probin;
+ int i_iscachable;
int i_usename;
/* find all user-defined funcs */
appendPQExpBuffer(query,
"SELECT pg_proc.oid, proname, prolang, pronargs, prorettype, "
- "proretset, proargtypes, prosrc, probin, usename "
+ "proretset, proargtypes, prosrc, probin, usename, "
+ "proiscachable "
"from pg_proc, pg_user "
"where pg_proc.oid > '%u'::oid and proowner = usesysid",
g_last_builtin_oid);
@@ -1492,6 +1494,7 @@
i_proretset = PQfnumber(res, "proretset");
i_prosrc = PQfnumber(res, "prosrc");
i_probin = PQfnumber(res, "probin");
+ i_iscachable = PQfnumber(res, "proiscachable");
i_usename = PQfnumber(res, "usename");
for (i = 0; i < ntups; i++)
@@ -1507,6 +1510,7 @@
finfo[i].nargs = atoi(PQgetvalue(res, i, i_pronargs));
finfo[i].lang = atoi(PQgetvalue(res, i, i_prolang));
finfo[i].usename = strdup(PQgetvalue(res, i, i_usename));
+ finfo[i].iscachable = (strcmp(PQgetvalue(res, i, i_iscachable),"t") == 0);
if (finfo[i].nargs < 0 || finfo[i].nargs > FUNC_MAX_ARGS)
{
fprintf(stderr, "failed sanity check: %s has %d args\n",
@@ -2663,11 +2667,18 @@
(j > 0) ? "," : "",
fmtId(typname, false));
}
- appendPQExpBuffer(q, " ) RETURNS %s%s AS '%s' LANGUAGE '%s';\n",
+ appendPQExpBuffer(q, " ) RETURNS %s%s AS '%s' LANGUAGE '%s'",
(finfo[i].retset) ? " SETOF " : "",
fmtId(findTypeByOid(tinfo, numTypes, finfo[i].prorettype), false),
func_def, func_lang);
+ if (finfo[i].iscachable) /* OR in new attrs here */
+ {
+ appendPQExpBuffer(q, " WITH (iscachable)");
+ }
+
+ appendPQExpBuffer(q, ";\n");
+
fputs(q->data, fout);
/*** Dump Function Comments ***/
diff -Naur pg_dump/pg_dump.h zzz/pg_dump.h
--- pg_dump/pg_dump.h Thu Apr 13 03:16:15 2000
+++ zzz/pg_dump.h Mon Aug 7 21:49:05 2000
@@ -61,6 +61,7 @@
char *prosrc;
char *probin;
char *usename;
+ int iscachable; /* Attr */
int dumped; /* 1 if already dumped */
} FuncInfo;
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.C.N. 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/
view thread (8+ messages) latest in thread
Message-ID: <3.0.5.32.20000807221238.0277eb30@mail.rhyme.com.au>
Permalink: ../3.0.5.32.20000807221238.0277eb30@mail.rhyme.com.au/
Also on: postgresql.org/message-id/3.0.5.32.20000807221238.0277eb30@mail.rhyme.com.au
copy link · copy postgr.es · copy git am
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-sql@postgresql.org
Cc: pjw@rhyme.com.au, angch@pintoo.com
Subject: Re: Functions too slow, even with iscachable?
In-Reply-To: <3.0.5.32.20000807221238.0277eb30@mail.rhyme.com.au>
References: <3.0.5.32.20000807221238.0277eb30@mail.rhyme.com.au>
* 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