Re: [GENERAL] 8.2.4 serious slowdown

2008-01-12 Thread Sim Zacks
How would you rewrite something like: WHERE (COALESCE(b.quantity, 0) - COALESCE(b.deliveredsum, 0)) > 0; I could write: where case when b.quantity is null then 0 else b.quantity end - case when b.deliveredsum is null then 0 else b.deliveredsum end > 0 It is butt ugly, but is that the most effi

Re: [GENERAL] 8.2.4 serious slowdown

2008-01-12 Thread Sim Zacks
Actually I just checked and the plan is exactly the same for those 2 clauses. Original Message Subject: Re:8.2.4 serious slowdown From: Sim Zacks <[EMAIL PROTECTED]> To: Date: Sunday, January 13, 2008 07:59:22 AM > How would you rewrite something like: > WHERE (COALESCE(b.

Re: [GENERAL] UPDATE .. JOIN?

2008-01-12 Thread Rodrigo E. De León Plicet
On Jan 12, 2008 11:26 PM, Sergei Shelukhin <[EMAIL PROTECTED]> wrote: > Hmmm. What if there's more than one table? Is "from x,y" a viable option? UPDATE table1 t1 SET blah = 1 FROM ( SELECT t2.t1id FROM table2 t2 JOIN table3 t3 ON t2.id = t3.t2id ) foobar WHERE t1.id = foobar.t1id It's al

Re: [GENERAL] UPDATE .. JOIN?

2008-01-12 Thread Rodrigo E. De León Plicet
On Jan 13, 2008 12:05 AM, I said > It's all in the docs: > http://www.postgresql.org/docs/8.2/static/sql-update.html To clarify, you can use the direct form, without using a subselect: UPDATE table1 t1 SET blah = 1 FROM table2 t2 JOIN table3 t3 ON t2.id = t3.t2id WHERE t1.id = t2.t1id Lookup

[GENERAL] ERROR during WAL replay

2008-01-12 Thread Gurjeet Singh
Hi All, We were trying to move a big database from one machine to the other using PITR mechanism. We hit the following LOG message in during the recovery (WAL replay) process" LOG: incorrect resource manager data checksum in record at 111/A7738C8 I had used this procedure to do such mig

Re: [GENERAL] UPDATE .. JOIN?

2008-01-12 Thread Sergei Shelukhin
Rodrigo E. De León Plicet wrote: On Jan 12, 2008 5:22 PM, Sergei Shelukhin <[EMAIL PROTECTED]> wrote: Hi. I was wondering if I could do something similar to this in Postgres and if yes how? UPDATE table1 SET blah = 1 FROM table1 INNER JOIN table2 ON table1.id = table2.t1id UPDATE

Re: [GENERAL] UPDATE .. JOIN?

2008-01-12 Thread Rodrigo E. De León Plicet
On Jan 12, 2008 5:22 PM, Sergei Shelukhin <[EMAIL PROTECTED]> wrote: > Hi. > > I was wondering if I could do something similar to this in Postgres and > if yes how? > > UPDATE table1 SET blah = 1 FROM table1 > INNER JOIN table2 ON table1.id = table2.t1id UPDATE table1 t1 SET blah = 1 FROM tabl

Re: [GENERAL] Prepared Statements

2008-01-12 Thread Tom Lane
Kris Jurka <[EMAIL PROTECTED]> writes: > On Thu, 10 Jan 2008, [EMAIL PROTECTED] wrote: >> What do you mean with "longer lifespan"? Doesn't the JDBC driver uses the >> PREPARE Sql Statement and therefore the prepared Statement has the same >> lifespan as the connection? If so, as connections are poo

Re: [GENERAL] Possible bug in PostgreSQL 8.3beta4 (postgres process segfaults)

2008-01-12 Thread Tom Lane
"Lawrence Oluyede" <[EMAIL PROTECTED]> writes: > Here it is: > postgres$ gdb /usr/local/pgsql/bin/postgres core.1600 > (gdb) bt > #0 0x082c101c in pfree (pointer=0x8472f00) at mcxt.c:591 > #1 0xb7e46513 in xmlCleanupCharEncodingHandlers () from /usr/lib/libxml2.so.2 > #2 0xb7e4f091 in xmlCleanup

Re: [GENERAL] Many 8.3 server crashes in xmlCleanupCharEncodingHandlers()

2008-01-12 Thread Tom Lane
"Matt Magoffin" <[EMAIL PROTECTED]> writes: > Hello, I'm using 8.3b4 and keep experiencing server crash when I execute > various queries using XML functions. Please see if it's better with 8.3RC1 plus this patch: http://archives.postgresql.org/pgsql-committers/2008-01/msg00190.php

[GENERAL] UPDATE .. JOIN?

2008-01-12 Thread Sergei Shelukhin
Hi. I was wondering if I could do something similar to this in Postgres and if yes how? UPDATE table1 SET blah = 1 FROM table1 INNER JOIN table2 ON table1.id = table2.t1id If not, is there any way to make UPDATE ... WHERE id IN () use indexes? ---(end of br

Re: [GENERAL] Prepared Statements

2008-01-12 Thread Kris Jurka
On Thu, 10 Jan 2008, [EMAIL PROTECTED] wrote: ah! So it doesn't help if it's the same statement, it has to be the same object! So DBCP has a statement pool like a map, say Map so it can fetch the reference to already existing prepared Statement by looking at the statement itself, right? Exac

Re: [GENERAL] How to safely compare transaction id?

2008-01-12 Thread Marko Kreen
On 1/12/08, alphax <[EMAIL PROTECTED]> wrote: > Thanks. Actually, I want to compares the system columns(xmin, xmax, > ctid) with the tid returned by txid functions declared in > > http://developer.postgresql.org/pgdocs/postgres/functions-info.html#FUNCTIONS-TXID-SNAPSHOT > > > I want to determines

Re: [GENERAL] know the schema name in a trigger

2008-01-12 Thread Tomasz Myrta
danilo.juvinao napisal 2008-01-12 01:18: Hello, i want know how can i get the schema name that execute a trigger. for example, if a have a schema "myschema" and a table "mytable" and it have a trigger procedure, i want know inside the trigger procedure, with plpgsql, the shcema name "myschema".

Re: [GENERAL] Postgres and MySQL Rosetta stone??

2008-01-12 Thread Martin
In article <[EMAIL PROTECTED]>, Erik Jones <[EMAIL PROTECTED]> wrote: >I'd suggest getting a different book that gives examples in >Postgres or, failing that, read the Postgres manual and learn >how to translate them yourself. I found O'Reilly's SQL Cookbo

Re: [GENERAL] Postgresql 8.2.4 on linux-sparc problem

2008-01-12 Thread Tom Lane
Zelinskiy Alexander <[EMAIL PROTECTED]> writes: > I understand that this description can't give you enough information > to give an advice what to do. But I don't know what to collect from OS/ > PG when it will happen again. Could you give me an advice what should > I do when next time one of

[GENERAL] Postgresql 8.2.4 on linux-sparc problem

2008-01-12 Thread Zelinskiy Alexander
Hello, all. I have a Postgresql 8.2.5 running on gentoo linux on sun fire v240 server with storage 3310. And sometimes I have a problem: time to time one postgres process starts using all CPU time. I can't kill this process. I can't stop postgres. I can't shutdown server at all from OS, o

Re: [GENERAL] tcp_keepalives_idle ignored

2008-01-12 Thread Tom Lane
"henry" <[EMAIL PROTECTED]> writes: > I have tried setting tcp_keepalives_idle = 120 (eg), then restarting PG, > but SHOW ALL; shows tcp_keepalives_idle=0 (ignoring my setting). Just FYI, this is the expected behavior on platforms where the kernel doesn't allow adjustment of the TCP keepalive para

Re: [GENERAL] tcp_keepalives_idle ignored

2008-01-12 Thread henry
On Sat, January 12, 2008 1:20 pm, Gregory Stark wrote: > "henry" <[EMAIL PROTECTED]> writes: > >> tcp_keepalives_interval and tcp_keepalives_count I have left on default. >> After a few hours worth of running, theres a few thousand idle postgres >> procs, and they're all idle... > > Are you sure th

Re: [GENERAL] tcp_keepalives_idle ignored

2008-01-12 Thread Jean-Michel Pouré
> We have a very busy setup using multiple clusters, slony, etc. My problem > relates to the number of postgres procs increasing, and not decreasing > when idle. I eventually end up with thousands of idle processes listening > on /tmp/.s.PGSQL.5432 and not quitting (eventually bumping into > max_

Re: [GENERAL] tcp_keepalives_idle ignored

2008-01-12 Thread Gregory Stark
"henry" <[EMAIL PROTECTED]> writes: > tcp_keepalives_interval and tcp_keepalives_count I have left on default. > After a few hours worth of running, theres a few thousand idle postgres > procs, and they're all idle... Are you sure the clients are actually gone? tcp keepalives are only going to h

[GENERAL] tcp_keepalives_idle ignored

2008-01-12 Thread henry
Hello all, PG: 8.2.4 We have a very busy setup using multiple clusters, slony, etc. My problem relates to the number of postgres procs increasing, and not decreasing when idle. I eventually end up with thousands of idle processes listening on /tmp/.s.PGSQL.5432 and not quitting (eventually bum