[SQL] Query performance and understanding explain analzye

2005-01-19 Thread Benjamin Wragg
Hi, I'm trying to tune a query that is taking to long to execute. I haven't done much sql tuning and have only had a little exposure to explain and explain analyze but from what I've read on the list and in books the following is generally true: Seq Scans are the almost always evil (except if a

Re: [SQL] ERROR: row is too big: size 9856, maximum size 8136

2005-01-19 Thread Michael Fuhr
On Wed, Jan 19, 2005 at 03:50:30PM -0500, Joel Fradkin wrote: > I get ERROR: row is too big: size 9856, maximum size 8136 when inserting a > view? Could you post the smallest possible self-contained example that demonstrates this behavior? What version of PostgreSQL are you using? -- Michael

[SQL] include in both ecpg and C++

2005-01-19 Thread none none
I have a header file that gets included by both C/C++ code and ecpg code. In this header are a few structs that get used by both code (C/C++ and ecpg). In order to get this to work for Informix, we had to do something like this in the header file: #ifdef TFLG EXEC SQL BEGIN DECLARE SECTION #e

Re: [SQL] Returning a bool on DELETE in a proc.

2005-01-19 Thread Michael Fuhr
On Wed, Jan 19, 2005 at 06:09:16PM +0100, KÖPFERL Robert wrote: > > > > Why SQL instead of PL/pgSQL if the former doesn't do what you need > > and the latter does? > > I have the feeling that even complicated and boxed queries are faster or can > be optimized by the planer than any PLpgsql. Isn't t

[SQL] ERROR: row is too big: size 9856, maximum size 8136

2005-01-19 Thread Joel Fradkin
I get ERROR:  row is too big: size 9856, maximum size 8136 when inserting a view?   Help   Joel Fradkin   Wazagua, LLC 2520 Trailmate Dr Sarasota, Florida 34243 Tel.  941-753-7111 ext 305   [EMAIL PROTECTED] www.wazagua.com Powered by Wazagua Providing you with the latest We

Re: [SQL] Conversion ideas (Views/procedures)

2005-01-19 Thread Keith Worthington
> I am new to Postgres and am converting our MSSQL database to Postgres. > > I just did my first function. > My question is does it make sense to create functions for some of > the common functionality available to the MSSQL world (left, isnull, > etc) so I do not need visit every view, and stor

Re: [SQL] Returning a bool on DELETE in a proc.

2005-01-19 Thread KÖPFERL Robert
It's ... hm I have the feeling that even complicated and boxed queries are faster or can be optimized by the planer than any PLpgsql. Isn't there a motule that has to be invoked? I'm capable to learn. > -Original Message- > From: Michael Fuhr [mailto:[EMAIL PROTECTED] > Sent: Mittwoch, 19

Re: [SQL] Returning a bool on DELETE in a proc.

2005-01-19 Thread Michael Fuhr
On Wed, Jan 19, 2005 at 11:24:26AM +0100, KÖPFERL Robert wrote: > Seems that I forgot to mention that this function is intended to be written > in SQL, not in PL/SQL. Why SQL instead of PL/pgSQL if the former doesn't do what you need and the latter does? -- Michael Fuhr http://www.fuhr.org/~mfu

Re: [SQL] Conversion ideas (Views/procedures)

2005-01-19 Thread KÖPFERL Robert
As so often, I would suggest regular languages to accomplish most of the work that comes up. Use for example ours all friend 'sed' to edit a big sql-dump. you can for example simply replace isnull(X) by X is null. RegEx will possibly not reach for all posibilities but the're very good for the fir

[SQL] Conversion ideas (Views/procedures)

2005-01-19 Thread Joel Fradkin
I am new to Postgres and am converting our MSSQL database to Postgres. I just did my first function. My question is does it make sense to create functions for some of the common functionality available to the MSSQL world (left, isnull, etc) so I do not need visit every view, and stored procedure t

Re: [SQL] Looking for examples of S/P

2005-01-19 Thread John DeSoi
On Jan 19, 2005, at 4:03 AM, KÖPFERL Robert wrote: In order to learn SQL-Stored Procedure techniqes I'm looking for a series of examples. Where can I find examples of SQL and PL/pgSQL based stored procedures? Or any of you who wants to donate some? The pgEdit distribution includes an extensive exa

Re: [SQL] Returning a bool on DELETE in a proc.

2005-01-19 Thread Karsten Hilbert
> >So what variable/function is the correct SQL-equivalent to ROW_COUNT and > >can it be used in the following statement ? > >like DELETE...; SELECT (ROW_COUNT<>0); to return a bool value? > > SQL doesn't support that (although I suppose it could be made to with > some pg_rows_affected() functio

Re: [SQL] Looking for examples of S/P

2005-01-19 Thread RobertD . Stewart
I use this stored procedure to insert data into tables from my web page. I call it using select insert_masteraccount($1,$,2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13); CREATE OR REPLACE FUNCTION insert_masteraccount("varchar", "varchar", "varchar", "varchar", "varchar", "varchar", "varchar", "varchar

Re: [SQL] Returning a bool on DELETE in a proc.

2005-01-19 Thread Richard Huxton
KÖPFERL Robert wrote: Thanks, but that was not what I was looking for. Seems that I forgot to mention that this function is intended to be written in SQL, not in PL/SQL. For the second one I already picked it off the fascinating* doc (as Keith did) that GET DIAGONSTIC is the right thing. So what va

Re: [SQL] mail + rfc822, rfc2822 + schema

2005-01-19 Thread Achilleus Mantzios
O Ron Peterson έγραψε στις Jan 18, 2005 : > On Tue, Jan 18, 2005 at 05:05:55PM +0200, Achilleus Mantzios wrote: > > > i am thinking of doing a remote MUA web-based system, based on > > postgresql. > > ... > > So, i'd like to know if any of you has designed a schema serving as an > > mail storage.

Re: [SQL] Returning a bool on DELETE in a proc.

2005-01-19 Thread KÖPFERL Robert
Thanks, but that was not what I was looking for. Seems that I forgot to mention that this function is intended to be written in SQL, not in PL/SQL. For the second one I already picked it off the fascinating* doc (as Keith did) that GET DIAGONSTIC is the right thing. So what variable/function is t

Re: [SQL] Looking for examples of S/P

2005-01-19 Thread Michael Fuhr
On Wed, Jan 19, 2005 at 10:03:13AM +0100, KÖPFERL Robert wrote: > In order to learn SQL-Stored Procedure techniqes I'm looking for a series of > examples. > Where can I find examples of SQL and PL/pgSQL based stored procedures? The General Bits column would be one place: http://www.varlena.com/v

[SQL] Looking for examples of S/P

2005-01-19 Thread KÖPFERL Robert
In order to learn SQL-Stored Procedure techniqes I'm looking for a series of examples. Where can I find examples of SQL and PL/pgSQL based stored procedures? Or any of you who wants to donate some? ---(end of broadcast)--- TIP 8: explain analyze is y