Re: [PERFORM] PL/pgSQL Loop Vs. Batch Update

2006-05-02 Thread David Wheeler
On May 2, 2006, at 16:52, David Wheeler wrote: Actually looks pretty good to me. Although is generate_series() being rather slow? Scratch that: Bah, dammit, there were no rows in that relevant table. Please disregard my previous EXPLAIN ANALYZE posts. I've re-run my script and populated

Re: [PERFORM] PL/pgSQL Loop Vs. Batch Update

2006-05-02 Thread David Wheeler
On May 2, 2006, at 16:49, David Wheeler wrote: On Apr 25, 2006, at 19:36, Tom Lane wrote: Try one of the actual queries from the plpgsql function. Here we go: try=# PREPARE foo(int, int[], int) AS try-# INSERT INTO entry_coll_tag (entry_id, tag_id, ord ) try-# SELECT $1, $2[gs.ser], gs.ser

Re: [PERFORM] PL/pgSQL Loop Vs. Batch Update

2006-05-02 Thread David Wheeler
On Apr 25, 2006, at 19:36, Tom Lane wrote: Try one of the actual queries from the plpgsql function. Here we go: try=# PREPARE foo(int, int[], int) AS try-# INSERT INTO entry_coll_tag (entry_id, tag_id, ord ) try-# SELECT $1, $2[gs.ser], gs.ser + $3 try-# FROM generate_series(1, array_upper(

Re: [PERFORM] PL/pgSQL Loop Vs. Batch Update

2006-04-25 Thread David Wheeler
On Apr 25, 2006, at 19:36, Tom Lane wrote: It looks like you had something trivial as the definition of foo(). Yeah, the function call. :-) Try one of the actual queries from the plpgsql function. Oh. Duh. Will do. Tomorrow. Best, David ---(end of broadcast)

Re: [PERFORM] PL/pgSQL Loop Vs. Batch Update

2006-04-25 Thread Tom Lane
David Wheeler <[EMAIL PROTECTED]> writes: > Just on a lark, I tried to get this to work: > try=# explain analyze EXECUTE foo(1, ARRAY > [61,62,63,64,65,66,67]); >QUERY PLAN > --

Re: [PERFORM] PL/pgSQL Loop Vs. Batch Update

2006-04-25 Thread David Wheeler
On Apr 25, 2006, at 18:19, Tom Lane wrote: You'd really have to look at the plans generated for each of the commands in the functions to be sure. A knee-jerk reaction is to suggest that that NOT IN might be the core of the problem, but it's only a guess. Well, the rows are indexed (I forgot t

Re: [PERFORM] PL/pgSQL Loop Vs. Batch Update

2006-04-25 Thread Tom Lane
David Wheeler <[EMAIL PROTECTED]> writes: > This post is longish and has a bit of code, but here's my question up- > front: Why are batch queries in my PL/pgSQL functions no faster than > iterating over a loop and executing a series of queries for each > iteration of the loop? You'd really ha

[PERFORM] PL/pgSQL Loop Vs. Batch Update

2006-04-25 Thread David Wheeler
Fellow PostgreSQLers, This post is longish and has a bit of code, but here's my question up- front: Why are batch queries in my PL/pgSQL functions no faster than iterating over a loop and executing a series of queries for each iteration of the loop? Are batch queries or array or series gen