Re: [GENERAL] Strange duplicate key violation error

2007-06-28 Thread Richard Huxton
Casey Duncan wrote: There are in fact one of these tables for each schema, each one contains exactly one row (the "log" in the name is a bit misleading, these just contain the current replica state, not a running log). 2007-06-28 08:53:54.937 PDT [d:radio_reports_new u:slony s:4683d86f.3681 3

Re: [GENERAL] date time function

2007-06-28 Thread A. Kretschmer
am Thu, dem 28.06.2007, um 16:04:48 -0400 mailte Jasbinder Singh Bali folgendes: > Hi, > > I have a timestamp field in my talbe. > I need to check its difference in days with the current date. > > field name is time_stamp and I did it as follows: > > select age(timestamp '2000-06-28 15:39:47.2

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > Oh, I was just thinking in way for Bruce to get out of his current > situation. Oh, for that a manual "drop table" as superuser should work fine. regards, tom lane ---(end of broadcast)--

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Alvaro Herrera
Tom Lane wrote: > Alvaro Herrera <[EMAIL PROTECTED]> writes: > > Tom Lane wrote: > >> Yeah, we had better investigate some way to clean them up. It was never > >> obvious before that it mattered to get rid of orphan temp tables, but I > >> guess it does. > > > Would it be enough to delete the tup

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> Yeah, we had better investigate some way to clean them up. It was never >> obvious before that it mattered to get rid of orphan temp tables, but I >> guess it does. > Would it be enough to delete the tuple from pg_class? No, you nee

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Alvaro Herrera
Tom Lane wrote: > Alvaro Herrera <[EMAIL PROTECTED]> writes: > > Well, it certainly seems like this shouldn't be happening. Maybe the > > table belonged to a session that crashed, but the pg_class entry has not > > been cleaned up -- possibly because that backend has not connected to > > that part

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > Well, it certainly seems like this shouldn't be happening. Maybe the > table belonged to a session that crashed, but the pg_class entry has not > been cleaned up -- possibly because that backend has not connected to > that particular database. Hm --- a

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Alvaro Herrera
Bruce, please make sure to keep the list copied on replies. I think there is an important bug here and I don't want it to get lost just because I lose track of it. I'm also crossposting to pgsql-hackers. Bruce McAlister wrote: > okidoki, I tried this: > > blueface-crm=# select relname, nspnam

Re: [GENERAL] date time function

2007-06-28 Thread Michael Glaesemann
On Jun 28, 2007, at 15:13 , Raymond O'Donnell wrote: Cast your result to type INTERVAL - something like this: postgres=# select (current_timestamp - timestamp '2007-05-01')::interval; interval -- 58 days 21:10:36.748 (1 row) The cast to interval is superfluous

Re: [GENERAL] date time function

2007-06-28 Thread Raymond O'Donnell
On 28/06/2007 21:04, Jasbinder Singh Bali wrote: How can i convert this result into absolute number of days. Cast your result to type INTERVAL - something like this: postgres=# select (current_timestamp - timestamp '2007-05-01')::interval; interval -- 58 days 21:1

[GENERAL] date time function

2007-06-28 Thread Jasbinder Singh Bali
Hi, I have a timestamp field in my talbe. I need to check its difference in days with the current date. field name is time_stamp and I did it as follows: select age(timestamp '2000-06-28 15:39:47.272045') it gives me something like 6 years 11 mons 29 days 08:20:12.727955 How can i convert th

Re: [GENERAL] i need a rad/ide open source for work with postgresql

2007-06-28 Thread Raymond O'Donnell
On 28/06/2007 18:47, Mario Jose Canto Barea wrote: why are you can make a good database relational server as postgresql 8.1, and dont make a rad/ide open source for programming with postgresql 8.1 as delphi\c++builder\progress 4gl ? Because they do different jobs. The languages you mention ar

Re: [GENERAL] OFFSET and LIMIT - performance

2007-06-28 Thread David Wall
Network transmission costs alone would make the second way a loser. Large OFFSETs are pretty inefficient because the backend generates and discards the rows internally ... but at least it never converts them to external form or ships them to the client. Rows beyond the LIMIT are not generated

Re: [GENERAL] OFFSET and LIMIT - performance

2007-06-28 Thread Tom Lane
"Jan Bilek" <[EMAIL PROTECTED]> writes: > I'm using PGDB with JDBC. In my app i need to select only portion of all = > available rows. I know i can do it two ways: > 1. I can use OFFSET and LIMIT SQL statements or > 2. I can select all rows and then filter requested portion in Java. > My question

Re: [GENERAL] [ADMIN] i need a rad/ide open source for work with postgresql

2007-06-28 Thread Joshua D. Drake
Mario Jose Canto Barea wrote: why are you can make a good database relational server as postgresql 8.1, and dont make a rad/ide open source for programming with postgresql 8.1 as delphi\c++builder\progress 4gl ? Uhhh.. why not just use delphi, or c++builder with ODBC? Joshua D. Drake th

Re: [GENERAL] a JOIN on same table, but 'slided over'

2007-06-28 Thread Gurjeet Singh
On 6/28/07, Alban Hertroys <[EMAIL PROTECTED]> wrote: This is called a 'correlated subquery'. Basically the subquery is performed for each record in the top query. Google gave me this: http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/sqlp/rbafycorrs.htm I think the su

[GENERAL] i need a rad/ide open source for work with postgresql

2007-06-28 Thread Mario Jose Canto Barea
why are you can make a good database relational server as postgresql 8.1, and dont make a rad/ide open source for programming with postgresql 8.1 as delphi\c++builder\progress 4gl ? thanks ___ Do Yo

[GENERAL] Strange duplicate key violation error

2007-06-28 Thread Casey Duncan
I have this table "replica_sync_log" which is updated thousands of times a day to reflect the state of various schemas in a database which acts as an offline secondary to various other databases (each of the source databases is mapped to its own schema in the secondary). The table has the f

Re: [GENERAL] using PREPAREd statements in CURSOR

2007-06-28 Thread Björn Lundin
28 jun 2007 kl. 16.45 skrev Tom Lane: =?ISO-8859-1?Q?Bj=F6rn_Lundin?= <[EMAIL PROTECTED]> writes: I'm connecting via libpq and want to use prepared statements in a cursor. You can't. That explains why I could not find an example... If you're just interested in fetching a large query resu

[GENERAL] OFFSET and LIMIT - performance

2007-06-28 Thread Jan Bilek
Hello, I'm using PGDB with JDBC. In my app i need to select only portion of all available rows. I know i can do it two ways: 1. I can use OFFSET and LIMIT SQL statements or 2. I can select all rows and then filter requested portion in Java. My question - Does the second way significantly affect p

Re: [GENERAL] Column Default Clause and User Defined Functions

2007-06-28 Thread Michael Glaesemann
On Jun 28, 2007, at 0:01 , Tom Lane wrote: Whether that is a good idea is another question entirely ... it seems a bit questionable, but on the other hand time-varying defaults like "default now()" have time-honored usefulness, so I'm not quite sure why I feel uncomfortable with it. I thought

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Bruce McAlister
Alvaro Herrera wrote: > > Bruce McAlister wrote: > > >> >> Alvaro Herrera wrote: >> >> >>> >>> Bruce McAlister wrote: >>> >>> Martijn van Oosterhout wrote: > > All the values here look OK, except one: > > > > On Thu, Jun 28, 2007 at 07:50:36AM +0100, Bruc

Re: [GENERAL] autovacumm not working ?

2007-06-28 Thread Alvaro Herrera
Tomasz Rakowski wrote: > > How restart of database server influances autovacuum process ? > > I think that somewhere on this mailing list I read that autovacuum in > such case looses some important information and after database server > restart will not behave as expected until VACUUM ANALYZE i

Re: [GENERAL] autovacumm not working ?

2007-06-28 Thread Tom Lane
Tomasz Rakowski <[EMAIL PROTECTED]> writes: > The strange thing is that number of pages allocated for "t_ais_position" > table and "t_ais_position_pkey" index haven't changed > (so autovacuum works ok on them) , but the number of pages allocated to > "ix_t_ais_position_update_time" index increa

Re: [GENERAL] autovacumm not working ?

2007-06-28 Thread Tomasz Rakowski
How restart of database server influances autovacuum process ? I think that somewhere on this mailing list I read that autovacuum in such case looses some important information and after database server restart will not behave as expected until VACUUM ANALYZE is executed. Is it true ? Tomas

Re: [GENERAL] autovacumm not working ?

2007-06-28 Thread Tomasz Rakowski
Hi there, I run VACUUM VERBOSE and the output from it is below: - INFO: vacuuming "ais.t_ais_position" INFO: scanned index "t_ais_position_pkey" to remove 972 row versions DETAIL: CPU 0.00s/0.00u sec elapsed 0.32 sec. INFO: scanned index "ix_t_ais_position_update_time" to remov

Re: [GENERAL] using PREPAREd statements in CURSOR

2007-06-28 Thread Tom Lane
=?ISO-8859-1?Q?Bj=F6rn_Lundin?= <[EMAIL PROTECTED]> writes: > I'm connecting via libpq and want to > use prepared statements in a cursor. You can't. If you're just interested in fetching a large query result in sections, there is protocol-level support for doing that without an explicit cursor, b

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Bruce McAlister
Alvaro Herrera wrote: > Bruce McAlister wrote: >> Martijn van Oosterhout wrote: >>> All the values here look OK, except one: >>> >>> On Thu, Jun 28, 2007 at 07:50:36AM +0100, Bruce McAlister wrote: blueface-crm=# select oid, relfrozenxid from pg_class where relkind in ('r', 't');

Re: [GENERAL] Execution variability

2007-06-28 Thread Alvaro Herrera
Vincenzo Romano escribió: > The values are here below. I suppose that the "hashed" > ones imply a default value. Correct (widely known as "commented out") > By the way, it seems that the problem arises with only one query, > while the other ones behave almost the same all the time. Let's see t

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Alvaro Herrera
Bruce McAlister wrote: > Martijn van Oosterhout wrote: > > All the values here look OK, except one: > > > > On Thu, Jun 28, 2007 at 07:50:36AM +0100, Bruce McAlister wrote: > >> blueface-crm=# select oid, relfrozenxid from pg_class where relkind in > >> ('r', 't'); > >>oid | relfrozenxid > >

Re: [GENERAL] Possible bug (or I don't understand how foreign keys should work with partitions)

2007-06-28 Thread Masaru Sugawara
On Fri, 22 Jun 2007 18:23:44 -0300 "Daniel van Ham Colchete" <[EMAIL PROTECTED]> wrote: Hi, As far as I read the documents(see below), it seems to be correct that no error message occurred in your case. http://www.postgresql.org/docs/8.2/interactive/ddl-inherit.html -- All check constraints a

Re: [GENERAL] Execution variability

2007-06-28 Thread Vincenzo Romano
Hi. The test system has 1GB Ram. The main table has 20+ million rows. All the other ones account for less than 10K rows. The values are here below. I suppose that the "hashed" ones imply a default value. shared_buffers = 24MB #temp_buffers = 8MB #max_prepared_transactions = 5 work_mem = 16MB #ma

Re: [GENERAL] Execution variability

2007-06-28 Thread Richard Huxton
Vincenzo Romano wrote: The very same query on the very same db shows very variable timings. I'm the only one client on an unpupolated server so I'd expect a rather constant timing. What's really weird is that after some time the timings get back to normal. With no explicit action. Then, later, t

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Martijn van Oosterhout
On Thu, Jun 28, 2007 at 11:12:19AM +0100, Bruce McAlister wrote: > I just want to verify that I understand you correctly here, do you mean > that the temporary table is created by specific sql, for example, create > temp table, then perform some actions on that temp table, then, either > you remove

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Dave Page
Bruce McAlister wrote: > Excuse my PGSQL ignorance, I'm new to PostgreSQL, and waiting for these > PGSQL books to become available: > > http://www.network-theory.co.uk/newtitles.html I'm pretty sure you'll find those are just bound copies of http://www.postgresql.org/docs/8.2/interactive/index.ht

Re: [GENERAL] Execution variability

2007-06-28 Thread Vincenzo Romano
On Thursday 28 June 2007 12:00:40 Richard Huxton wrote: > Vincenzo Romano wrote: > > On Wednesday 27 June 2007 23:46:25 Vincenzo Romano wrote: > >> Hi all. > >> I understand this can be a ridiculous question for most you. > >> > >> The very same query on the very same db shows very variable > >> ti

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Bruce McAlister
Alban Hertroys wrote: > Bruce McAlister wrote: >> Which brings me onto a possibly related question. I've noticed that in >> this particular database, that there are temporary tables that are >> created. I'm not 100% sure how/why these temporary tables are being >> created, but I do assume that it m

Re: [GENERAL] Execution variability

2007-06-28 Thread Richard Huxton
Vincenzo Romano wrote: On Wednesday 27 June 2007 23:46:25 Vincenzo Romano wrote: Hi all. I understand this can be a ridiculous question for most you. The very same query on the very same db shows very variable timings. I'm the only one client on an unpupolated server so I'd expect a rather cons

Re: [GENERAL] Image Archiving with postgres

2007-06-28 Thread Raymond O'Donnell
On 28/06/2007 00:58, Eddy D. Sanchez wrote: I want to scan a large quantity of books and documents and store these like images, I want use postgres, anyone have experience with this kind of systems, can you suggest me an opensource solution ?? There have been several lively discussions on thi

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Alban Hertroys
Bruce McAlister wrote: > Which brings me onto a possibly related question. I've noticed that in > this particular database, that there are temporary tables that are > created. I'm not 100% sure how/why these temporary tables are being > created, but I do assume that it must be by some sort of SQL q

Re: [GENERAL] a JOIN on same table, but 'slided over'

2007-06-28 Thread Alban Hertroys
Rafal Pietrak wrote: > Gurjeet, > > Focusing on the standars solution, I did some 'exercises' - works fine, > just learning. > > But the ambarasing thing is, that I looks like I really don't get it, > meaning - what exactly the internal query does. I've never ever seen or > used a subquery with

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Bruce McAlister
Martijn van Oosterhout wrote: > All the values here look OK, except one: > > On Thu, Jun 28, 2007 at 07:50:36AM +0100, Bruce McAlister wrote: >> blueface-crm=# select oid, relfrozenxid from pg_class where relkind in >> ('r', 't'); >>oid | relfrozenxid >> -+-- >> 2570051

Re: [GENERAL] a JOIN on same table, but 'slided over'

2007-06-28 Thread Rafal Pietrak
Gurjeet, Focusing on the standars solution, I did some 'exercises' - works fine, just learning. But the ambarasing thing is, that I looks like I really don't get it, meaning - what exactly the internal query does. I've never ever seen or used a subquery with data/params from 'upper level' query

[GENERAL] using PREPAREd statements in CURSOR

2007-06-28 Thread Björn Lundin
Hello! I'm connecting via libpq and want to use prepared statements in a cursor. Is there a sample somewhere, since I cannot get it to work. sebjlun=# \d ssignal Table "public.ssignal" Column | Type | Modifiers -+---+--- ssignam | character(12) | not

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Martijn van Oosterhout
All the values here look OK, except one: On Thu, Jun 28, 2007 at 07:50:36AM +0100, Bruce McAlister wrote: > blueface-crm=# select oid, relfrozenxid from pg_class where relkind in > ('r', 't'); >oid | relfrozenxid > -+-- > 2570051 | 2947120794 Whatever this table is, t

Re: [GENERAL] Execution variability

2007-06-28 Thread Vincenzo Romano
On Wednesday 27 June 2007 23:46:25 Vincenzo Romano wrote: > Hi all. > I understand this can be a ridiculous question for most you. > > The very same query on the very same db shows very variable > timings. I'm the only one client on an unpupolated server so I'd > expect a rather constant timing. >

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-28 Thread Bruce McAlister
Bruce McAlister wrote: > I will run with DEBUG2 for a while and see if my output looks anything > like this :) I've been running in DEBUG2 mode for a couple days now and I can see the extra information being logged into the log file, but it looks like the autovacuum is not actually starting, it d