Re: [GENERAL] how to make this database / query faster

2008-03-16 Thread Volkan YAZICI
On Sat, 15 Mar 2008, mark <[EMAIL PROTECTED]> writes: > select * from users where session_key is not Null order by id offset OFFSET > limit 300 > > i want to go through the whole table... it gets really slow like > greater than 5 minutes when the OFFSET is over 500,000.. Did you try your chance w

[GENERAL] on insert when ... do instead update

2008-03-16 Thread askel
Hello everybody! I'm having problem with postgresql 8.3 (not sure if it is related to this particular version). Suppose we have accounting system database with the following rule (no other rules are there): create or replace rule update_or_create_balance as on insert to ledger when exists (select

Re: [GENERAL] how to make this database / query faster

2008-03-16 Thread Richard Broersma
On Sat, Mar 15, 2008 at 5:04 PM, brian <[EMAIL PROTECTED]> wrote: > As there's an index on id would it be faster to transpose the WHERE > conditions? > > WHERE id > your_last_id > AND session_key IS NOT NULL > > I can't remember if the order of WHERE is significant. > I don't think that the order

Re: [GENERAL] how to make this database / query faster

2008-03-16 Thread Martin Gainty
Hi Richard- My understanding is that Partial index is implemented for low cardinality scenarios ('Y'/'N') ('T'/'F') (null/not null) ? http://en.wikipedia.org/wiki/Partial_index Would it matter the selectivity is balanced? thus 1 null record and 1 trillion null records would not apply ? Martin-

Re: [GENERAL] on insert when ... do instead update

2008-03-16 Thread Tom Lane
askel <[EMAIL PROTECTED]> writes: > Hello everybody! > I'm having problem with postgresql 8.3 (not sure if it is related to > this particular version). Suppose we have accounting system database > with the following rule (no other rules are there): > create or replace rule update_or_create_balance

Re: [GENERAL] how to make this database / query faster

2008-03-16 Thread Richard Broersma
On Sun, Mar 16, 2008 at 9:47 AM, Martin Gainty <[EMAIL PROTECTED]> wrote: > My understanding is that Partial index is implemented for low cardinality > scenarios ('Y'/'N') ('T'/'F') (null/not null) ? > http://en.wikipedia.org/wiki/Partial_index > Low cardinality can apply for more than just bool

[GENERAL] Redundant file server for postgres

2008-03-16 Thread Robert Powell
To whom it may concern, I'm looking for a file server that will give me a high level of redundancy and high performance for a postgres database. The server will be running only postgres as a backend service, connected to a front end server with the application on it. I was thinking along th

Re: [GENERAL] Redundant file server for postgres

2008-03-16 Thread Karl Denninger
What's the expected transaction split (read/write)? If mostly READs (e.g. SELECTs) then its very, very hard to do better from a performance perspective than Raid 1 with the transaction log on a separate array (physically separate spindles) I run a VERY busy web forum on a Quadcore Intel box w

Re: [GENERAL] Redundant file server for postgres

2008-03-16 Thread Craig Ringer
Robert Powell wrote: To whom it may concern, I'm looking for a file server that will give me a high level of redundancy and high performance for a postgres database. For strong redundancy and availability you may need a secondary server and some sort of replication setup (be it a WAL-follow

Re: [GENERAL] How to silence psql notices, warnings, etc.?

2008-03-16 Thread Scott Marlowe
On Fri, Mar 14, 2008 at 2:28 PM, Kynn Jones <[EMAIL PROTECTED]> wrote: > Hi! > > How does one silence NOTICE and WARNING messages in psql? I've tried \set > QUIET on, \set VERBOSITY terse, and even \o /dev/null, but I still get them! If you start postgresql from the pg_ctl command line and it's s

Re: [GENERAL] Redundant file server for postgres

2008-03-16 Thread Karl Denninger
Craig Ringer wrote: Robert Powell wrote: To whom it may concern, I'm looking for a file server that will give me a high level of redundancy and high performance for a postgres database. For strong redundancy and availability you may need a secondary server and some sort of replication set

[GENERAL] UPDATE stalls when run in "batch mode"

2008-03-16 Thread Kynn Jones
I was running an SQL file in psql (via \i) and I noticed that the execution had been stuck at a particular place for a few hours, which was far longer than expected. So I killed the processing of the file (with Ctrl-C), vacuumed everything I could think of and tried again. The same thing happened

Re: [GENERAL] Redundant file server for postgres

2008-03-16 Thread Scott Marlowe
On Sun, Mar 16, 2008 at 1:02 PM, Karl Denninger <[EMAIL PROTECTED]> wrote: > > > > The key issue on RAM is not whether the database will fit into RAM (for > all but the most trivial applications, it will not) I would argue that many applications where the data fits into memory are not trivial.

Re: [GENERAL] Trigger to run @ connection time?

2008-03-16 Thread Robert Treat
On Friday 14 March 2008 11:36, Marko Kreen wrote: > On 3/14/08, Erik Jones <[EMAIL PROTECTED]> wrote: > > On Mar 14, 2008, at 7:17 AM, Marko Kreen wrote: > > > To put it to core Postgres, it needs to be conceptually sane > > > first, without needing ugly workarounds to avoid it bringing > > > w

Re: [GENERAL] UPDATE stalls when run in "batch mode"

2008-03-16 Thread Tom Lane
"Kynn Jones" <[EMAIL PROTECTED]> writes: > I can't begin to guess why the update statement above caused the processing > to stall, but ran quickly when I executed it by itself. How can I > understand this situation better? Perhaps it was blocked on a lock rather than actually doing anything. Did

[GENERAL] Updating

2008-03-16 Thread Bob Pawley
Is there a method available for triggering a function after an update on a particular column in a table? The only way that I have found is to trigger after an update on the whole table, which of course can lead to problems. Bob -- Sent via pgsql-general mailing list (pgsql-general@postgre

Re: [GENERAL] Updating

2008-03-16 Thread Adrian Klaver
On Sunday 16 March 2008 3:32 pm, Bob Pawley wrote: > Is there a method available for triggering a function after an update on a > particular column in a table? > > The only way that I have found is to trigger after an update on the whole > table, which of course can lead to problems. > > Bob I tri

Re: [GENERAL] Updating

2008-03-16 Thread Andreas 'ads' Scherbaum
Hello, On Sun, 16 Mar 2008 15:32:27 -0700 Bob Pawley wrote: > Is there a method available for triggering a function after an update on a > particular column in a table? > > The only way that I have found is to trigger after an update on the whole > table, which of course can lead to problems.

Re: [GENERAL] Updating

2008-03-16 Thread Bob Pawley
Would it be possible to get an example of such coding?? Bob - Original Message - From: "Adrian Klaver" <[EMAIL PROTECTED]> To: Cc: "Bob Pawley" <[EMAIL PROTECTED]> Sent: Sunday, March 16, 2008 5:14 PM Subject: Re: [GENERAL] Updating On Sunday 16 March 2008 3:32 pm, Bob Pawley wrot

Re: [GENERAL] Updating

2008-03-16 Thread Adrian Klaver
On Sunday 16 March 2008 5:36 pm, Bob Pawley wrote: > Would it be possible to get an example of such coding?? > > Bob > > > - Original Message - > From: "Adrian Klaver" <[EMAIL PROTECTED]> > To: > Cc: "Bob Pawley" <[EMAIL PROTECTED]> > Sent: Sunday, March 16, 2008 5:14 PM > Subject: Re: [GE

Re: [GENERAL] Updating

2008-03-16 Thread Harvey, Allan AC
> Would it be possible to get an example of such coding?? This trigger has an argument passed. When the trigger is "assigned" I know whether the column is of type txt or float. It uses the column name to determine what to do. Hope this helps Allan create or replace function insert_if_diff() re

[GENERAL] array function problem

2008-03-16 Thread tuanhoanganh
I have a array function CREATE OR REPLACE FUNCTION "temp".rowfromarray(text[]) RETURNS SETOF text AS $BODY$DECLARE _returntext; BEGIN for i in 1..array_upper($1,1) loop _return := $1[i]; return next _return; end loop; return; END;$BODY$ LANGUAGE 'plpgsql' VOL

Re: [GENERAL] array function problem

2008-03-16 Thread Tom Lane
tuanhoanganh <[EMAIL PROTECTED]> writes: > I call it by command > select temp.rowfromarray(string_to_array('1,2,3,4,5', ',')); > but it have error > ERROR: set-valued function called in context that cannot accept a set You need to say select * from temp.rowfromarray(string_to_array('1,2,3