[GENERAL] Understanding EXPLAIN

2012-02-02 Thread Robert Lichtenberger
I am trying to fully understand, how costs for queries are computed. Taking the following example: CREATE TABLE test (name varchar(250) primary key) ; INSERT INTO test (name) VALUES(generate_series(1, 1000)::text) ; ANALYZE test ; EXPLAIN SELECT * FROM test WHERE name = '4' ; I am getting the o

[GENERAL] Temporal foreign keys

2012-02-02 Thread Matthias
Hey, how can I implement temporal foreign keys with postgresql? Is writing triggers the only way to enforce temporal referential integrity currently? -Matthias -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/m

Re: [GENERAL] [GENERA]: Postgresql-9.1.1 synchronous replication issue

2012-02-02 Thread Venkat Balaji
On Thu, Feb 2, 2012 at 8:37 PM, Adrian Klaver wrote: > On Wednesday, February 01, 2012 10:51:44 pm Venkat Balaji wrote: > > Hello, > > > > I was testing the Postgres-9.1.1 synchronous streaming replication on our > > UAT system. > > > > Without synchronous replication, everything was working fine.

Re: [GENERAL] Functions To Let Users Cancel/Terminate own Back Ends

2012-02-02 Thread David E. Wheeler
On Feb 2, 2012, at 2:51 PM, Magnus Hagander wrote: >> I have a need at my $dayjob to let users cancel their own back ends. See any >> issues with this function to allow them to do that? Any security gotchas or >> anything? > > You mean something like this? > http://git.postgresql.org/gitweb/?p=

Re: [GENERAL] Functions To Let Users Cancel/Terminate own Back Ends

2012-02-02 Thread Magnus Hagander
On Thu, Feb 2, 2012 at 23:38, David E. Wheeler wrote: > PostgreSQLers, > > I have a need at my $dayjob to let users cancel their own back ends. See any > issues with this function to allow them to do that? Any security gotchas or > anything? You mean something like this? http://git.postgresql.o

[GENERAL] Functions To Let Users Cancel/Terminate own Back Ends

2012-02-02 Thread David E. Wheeler
PostgreSQLers, I have a need at my $dayjob to let users cancel their own back ends. See any issues with this function to allow them to do that? Any security gotchas or anything? CREATE OR REPLACE FUNCTION iov_cancel_user_backend( pid INTEGER ) RETURNS BOOLEAN LANGUAGE plpgsql SECURITY DEFIN

[GENERAL] xlog min recovery request ... is past current point ...

2012-02-02 Thread Christophe Pettus
PostgreSQL 9.0.4: While bringing up a streaming replica, and while it is working its way through the WAL segments before connecting to the primary, I see a lot of messages of the form: 2012-02-01 21:26:13.978 PST,,,24448,,4f2a1e61.5f80,54,,2012-02-01 21:25:53 PST,1/0,0,LOG,0,"restored log

Re: [GENERAL] 9.0 EXPLAIN Buffers: written=nnnn

2012-02-02 Thread Rodrigo Gonzalez
El Thu, 2 Feb 2012 12:03:20 -0500 escribió: > Do EXPLAIN ANALYZE: > > written=2325 ! > > "Total runtime: 375542.347 ms" > > > Then Do EXPLAIN ANALYZE again: > In general, can you tell me why [written=2325] is displayed by the > first EXPLAIN, but not the second EXPLAIN ? The query is

[GENERAL] 9.0 EXPLAIN Buffers: written=nnnn

2012-02-02 Thread david.sahagian
Do EXPLAIN ANALYZE: . . . only showing the bottom node . . . -> Seq Scan on Y (cost=0.00..37962.29 rows=876029 width=40) (actual time=16.728..92555.945 rows=876002 loops=1) Output: foo, bar Buffers: shared hit=146 read=29056 written=2325 ! "Total runtime: 375542.347 ms" Then Do

Re: [GENERAL] Is it possible to speed up addition of "not null"?

2012-02-02 Thread Andrew Sullivan
On Thu, Feb 02, 2012 at 02:20:59PM +0100, hubert depesz lubaczewski wrote> > Sure. But at least theoretically, it could use index - for example, if > I had index "where column is null". To build that index, you had to visit every row too. But I see what your problem is. > But this should be nea

Re: [GENERAL] [GENERA]: Postgresql-9.1.1 synchronous replication issue

2012-02-02 Thread Adrian Klaver
On Wednesday, February 01, 2012 10:51:44 pm Venkat Balaji wrote: > Hello, > > I was testing the Postgres-9.1.1 synchronous streaming replication on our > UAT system. > > Without synchronous replication, everything was working fine. > > But, when i enabled synchronous_replication_names='*', the "

Re: [GENERAL] Audtiting, DDL and DML in same SQL Function

2012-02-02 Thread Christian Ramseyer
On 2/2/12 12:39 AM, Scott Marlowe wrote: > On Wed, Feb 1, 2012 at 4:27 PM, Scott Marlowe wrote: >> On Wed, Feb 1, 2012 at 3:29 PM, Christian Ramseyer wrote: >>> Optimally, I'd just have my applications perform a single >>> call after connecting, e.g. "audit_init('USERNAME', 'Name of application')

Re: [GENERAL] Is it possible to speed up addition of "not null"?

2012-02-02 Thread Florian Weimer
* hubert depesz lubaczewski: > procedure would look like: > 1. update pg_attribute set attnotnull = true where attrelid = > 'my_table'::regclass and attname = 'not-null-column'; > 2. delete from my_table where not-null-column is null; -- this shouldn't >do anything, as I know that there are n

Re: [GENERAL] Is it possible to speed up addition of "not null"?

2012-02-02 Thread hubert depesz lubaczewski
On Thu, Feb 02, 2012 at 02:08:51PM +, Florian Weimer wrote: > * hubert depesz lubaczewski: > > > I tried with some indexes, but I can't get the time to something > > reasonable, so here is my question: is there any way I could make the > > "not null" constraint *fast*? > > You coul patch pg_a

Re: [GENERAL] Puzzling full database lock

2012-02-02 Thread Florian Weimer
* Christopher Opena: > We've been running into some very strange issues of late with our > PostgreSQL database(s). We have an issue where a couple of queries push > high CPU on a few of our processors and the entire database locks (reads, > writes, console cannot be achieved unless the high CPU q

Re: [GENERAL] Is it possible to speed up addition of "not null"?

2012-02-02 Thread Florian Weimer
* hubert depesz lubaczewski: > I tried with some indexes, but I can't get the time to something > reasonable, so here is my question: is there any way I could make the > "not null" constraint *fast*? You coul patch pg_attribute directly. I'm not sure if that's still safe in current versions, tho

Re: [GENERAL] Puzzling full database lock

2012-02-02 Thread Merlin Moncure
On Wed, Feb 1, 2012 at 6:38 PM, Christopher Opena wrote: > Hello folks, > > We've been running into some very strange issues of late with our PostgreSQL > database(s).  We have an issue where a couple of queries push high CPU on a > few of our processors and the entire database locks (reads, write

Re: [GENERAL] Is it possible to speed up addition of "not null"?

2012-02-02 Thread hubert depesz lubaczewski
On Thu, Feb 02, 2012 at 07:26:15AM -0500, Andrew Sullivan wrote: > > I need to add not null on one of the columns, but it seems to require > > full table scan. > Of course it does. If you want a constraint added to the table, the > first thing it ought to do is check that all your data actually >

Re: [GENERAL] parameter "vacuum_defer_cleanup_age"

2012-02-02 Thread Tulio
Hi Marti, The parameter statement_timeout isn't configured.. I'm using the value default.. 0.. And this is happening when I'm doing large querys on the slave.. thanks, Tulio Em 01/02/2012 12:33, Marti Raudsepp escreveu: On Mon, Jan

Re: [GENERAL] Is it possible to speed up addition of "not null"?

2012-02-02 Thread Andrew Sullivan
On Thu, Feb 02, 2012 at 12:48:04PM +0100, hubert depesz lubaczewski wrote > I need to add not null on one of the columns, but it seems to require > full table scan. Of course it does. If you want a constraint added to the table, the first thing it ought to do is check that all your data actually

Re: EXT :Re: [GENERAL] Intermittent occurrence of ERROR: could not open relation

2012-02-02 Thread Nykolyn, Andy (AS)
Well I have been running the function using the data you sent against both an 8.4.1 and 8.4.9 instance on and off a good part of the day. At this point we are talking many thousands of runs. In either case I have not seen an error. So either I am incredibly lucky(I wish) or something is going o

[GENERAL] Is it possible to speed up addition of "not null"?

2012-02-02 Thread hubert depesz lubaczewski
I have 8.3 database with non-trivial table (~ 80million rows, but the rows are just two integers). I need to add not null on one of the columns, but it seems to require full table scan. I tried with some indexes, but I can't get the time to something reasonable, so here is my question: is there a

[GENERAL] Deadlock report

2012-02-02 Thread bdmyt...@eranet.pl
Hi, I found patch for 8.4: When reporting a deadlock, report the text of all queries involved in the deadlock to the server log (Itagaki Takahiro) My question is how to enable this feature in 9.1.2 - is it activated out of the box or do I have to enable it somehow? Regards, Bartek Pozdrawiam, Bar

Re: [GENERAL] pg_dump -s dumps data?!

2012-02-02 Thread hubert depesz lubaczewski
On Wed, Feb 01, 2012 at 10:02:14PM +0100, Dimitri Fontaine wrote: > The case for a table that is partly user data and partly extension data > is very thin, I think that if I had this need I would use inheritance > and a CHECK(user_data is true/false) constraint to filter the data. definitely agree

[GENERAL] Facing issue in online recovery of pgpool-II

2012-02-02 Thread Saurabh
Hi all, I am using postgresql streaming replication for my project. For automatic failover and online recovery I am trying to use pgpool-II. Failover is working fine. But in online recovery I am facing issue. When I am trying to recover master node (which was down earlier) as slave node then maste

Re: [GENERAL] Audtiting, DDL and DML in same SQL Function

2012-02-02 Thread Dean Rasheed
On 1 February 2012 22:29, Christian Ramseyer wrote: > Hello list > > I'm trying to build a little trigger-based auditing for various web > applications. They have many users in the application layer, but they > all use the same Postgres DB and DB user. > > So I need some kind of session storage to