Re: [GENERAL] undead index

2011-05-06 Thread Jens Wilke
On Thursday 05 May 2011 16:46:05 Cédric Villemain wrote: > I understood that you droped an index and when you dump/restore you > get your index again. Yes, that's it, after the pg_upgrade error, i removed the target data directory, and initialzed a new target DB. After pg_dumpall|pg_dump i got a

Re: [GENERAL] undead index

2011-05-06 Thread Cédric Villemain
2011/5/6 Jens Wilke : > On Thursday 05 May 2011 16:46:05 Cédric Villemain wrote: > >> I understood that you droped an index and when you dump/restore you >> get your index again. > > Yes, that's it, after the pg_upgrade error, i removed the target data > directory, and initialzed a new target DB. >

[GENERAL] Foreign key in composite values

2011-05-06 Thread Vincent De Groote
Hello, I have a composite type with 2 fields. I would like to check that one of these fields exists in another table. Foreign keys on a composite field does not seem to be supported. Is there another way to do that ? Thanks for your reply Vincent De Groote

Re: [GENERAL] Generating fields in views with search/replace?

2011-05-06 Thread Asfand Qazi (Sanger Institute)
On Thu, May 5, 2011 at 8:37 PM, Bosco Rama wrote: > Asfand Qazi (Sanger Institute) wrote: >> >> Say I have a table with fields 'template' and 'original_letter', and >> 'new_selected_letter'.  'template' could be 'abcdefg0abcdefg', >> original_letter could be 'A' and new_selected_letter could be 'B

[GENERAL] create table within a schema

2011-05-06 Thread Vincent De Groote
Hello I have the following code: create schema test; create type test.my_type as enum ( 'a', 'b' ); create table test.my_table_1 ( id bigserial not null, type test.my_type not null, length bigint, primary key ( id ) ); create sequence test.my_sequence_id; create table

Re: [GENERAL] create table within a schema

2011-05-06 Thread Simon Riggs
On Fri, May 6, 2011 at 12:10 PM, Vincent De Groote wrote: > Hello > > I have the following code: > > create schema test; > > create type test.my_type as enum ( 'a', 'b' ); > > create table test.my_table_1 ( >     id bigserial not null, >     type   test.my_type not null, >     length bigint, >

Re: [GENERAL] Multiple table relationship constraints

2011-05-06 Thread Misa Simic
I think the best way is what David has suggested... But if it is already live, and there is no way to handle clients app to work with functions (instead of Direct SQL statements) then I think trigger function would help... (not sure how it could be error prone..) So basically if function is Val

Re: [GENERAL] ZEOS or PGDAC - How to lock a resource?

2011-05-06 Thread Mark Morgan Lloyd
Merlin Moncure wrote: 2011/5/4 durumdara : Hi! We will porting an application to PGSQL from some table based app (BDE like). The older application used a special technic of the driver: if a record edited, some exclusive (over transaction), "forever living" lock put on it. On exit, cancel, or p

Re: [GENERAL] Bidirectional replication

2011-05-06 Thread Andrew Sullivan
On Thu, May 05, 2011 at 09:22:14PM -0600, Joshua Tolley wrote: > course, but it is trigger based. One notable difference between Bucardo and > Slony is that whereas Slony's triggers store the entire row data in a separate > log table when something changes, Bucardo stores only the primary key. T

Re: [GENERAL] Bidirectional replication

2011-05-06 Thread Vick Khera
On Fri, May 6, 2011 at 8:59 AM, Andrew Sullivan wrote: > That's interesting.  An earlier replication system we had at Afilias > (erserver, which was descended from the rserv code that used to be in > contrib/) used this strategy.[1] > Oh... I remember erserver. It served us well for about 2 year

[GENERAL] Growing a live database

2011-05-06 Thread Rick Genter
I have a PostgreSQL 8.4.4 database that is running 24/7. The drive that the database is on is becoming full and I need to expand it. We are currently doing log-shipping of the WAL files to a slave system to run in a hot standby mode. I have two servers: S1 (currently running as master) and S2 (curr

Re: [GENERAL] Growing a live database

2011-05-06 Thread Vick Khera
On Fri, May 6, 2011 at 9:27 AM, Rick Genter wrote: > I believe that this accomplishes the goal (increasing available drive space) > with a minimum amount of down time. Am I thinking correctly, or have I > missed something? > That is the general procedure you would follow to perform maintenance on

[GENERAL] Default Operator Class for datatype

2011-05-06 Thread Jakub Królikowski
No ideas? 2011/5/4 Jakub Królikowski : > Hello, > > I've set pl_PL.UTF-8 collation on my database after upgrade do 9.0. > That means indexes for varchar column doesn't work anymore in selects > using "like" or "=" operators with that columns. > I know the solution - operator classes - which works

Re: [GENERAL] dblink() from GridSQL

2011-05-06 Thread Mason S
> > > Hi List, > > > We have a customer who is trying to migrate a few PostgresPlus instances > > to > > > GridSQL clusters. They have a process that pulls data from another > > server > > > using dblink every night, and we're trying to replicate that on the > > GridSQL > > > instance, but grid is

Re: [GENERAL] Foreign key in composite values

2011-05-06 Thread Tom Lane
Vincent De Groote writes: > I have a composite type with 2 fields. I would like to check that one > of these fields exists in another table. > Foreign keys on a composite field does not seem to be supported. Works for me, in 8.4 and up. Whether it's a good idea is a different issue (I think it'

Re: [GENERAL] Bidirectional replication

2011-05-06 Thread Andrew Sullivan
On Fri, May 06, 2011 at 09:15:37AM -0400, Vick Khera wrote: > > Oh... I remember erserver. It served us well for about 2 years for a > simple, not very high-velocity database that was 99.44% read-only. I > did have to monitor it closely and restart regularly. At least with > slony I don't worry

Re: [GENERAL] undead index

2011-05-06 Thread Jens Wilke
On Wednesday 04 May 2011 17:32:50 Tom Lane wrote: > Hmm, is this an autogenerated index? I don't think so. And to confirm, that i really deleted the new cluster between the pg_upgrade run and the dump|restore i did it again and was able to revive this index again: foo=# \d+ foo.bar_idx

[GENERAL] Locale and UTF8 for template1 in 8.4.4

2011-05-06 Thread Iain Barnett
Hi, I'd like to change the template1 database to be in UTF8 and en_GB, so that all databases I create (unless specified otherwise) will start with that encoding by default, if I understand correctly. I've searched around for how to do this but can't seem to get what I've found to work. If I ru

[GENERAL] psql and query buffer mangling

2011-05-06 Thread Daniele Varrazzo
Hello, I see psql performs some elaboration on the input query before storing it in the query buffer: for instance variables are replaced: =# \set test 10 =# select :test; ?column? -- 10 (1 row) =# \p select 10; and comments are stripped: dum

Re: [GENERAL] undead index

2011-05-06 Thread Tom Lane
Jens Wilke writes: > On Wednesday 04 May 2011 17:32:50 Tom Lane wrote: >> Hmm, is this an autogenerated index? > I don't think so. > And to confirm, that i really deleted the new cluster between the pg_upgrade > run and the dump|restore i did it again and was able to revive this index > again:

Re: [GENERAL] Locale and UTF8 for template1 in 8.4.4

2011-05-06 Thread Alan Hodgson
On May 6, 2011, Iain Barnett wrote: > Would anyone be able to point out to me how I can get the template1 > database to be utf8 and en_GB? (or US, I'm not *that* fussed) Use the --encoding and --locale options to initdb.

Re: [GENERAL] undead index

2011-05-06 Thread Jens Wilke
On Friday 06 May 2011 17:18:29 Tom Lane wrote: Hi Tom, > Possibly if > you showed us the actual (not obfuscated) table declaration, associated > constraint declarations, and resulting index definition, things would be > clearer. Thanks Tom, yes, the index is named Indexes: "concurrently" btr

Re: [GENERAL] undead index

2011-05-06 Thread Tom Lane
Jens Wilke writes: > Thanks Tom, yes, the index is named > Indexes: > "concurrently" btree (ulq_guid) > In the 8.4 cluster and 9.0.4's pg_dumpall dumps it as > CREATE INDEX concurrently ON foo USING btree (ulq_guid); > That's it. Oh, fun. We knew that not reserving that keyword was going t

Re: [GENERAL] Locale and UTF8 for template1 in 8.4.4

2011-05-06 Thread Iain Barnett
On 6 May 2011, at 16:19, Alan Hodgson wrote: > On May 6, 2011, Iain Barnett wrote: > > Would anyone be able to point out to me how I can get the template1 > > database to be utf8 and en_GB? (or US, I'm not *that* fussed) > Use the --encoding and --locale options to initdb. I had to backup the P

Re: [GENERAL] undead index

2011-05-06 Thread Tom Lane
I wrote: > It's not pg_upgrade's fault; it's pg_dump that's failing to reproduce > the state of the source database. > I'm inclined to think that maybe we should hack pg_dump to forcibly > quote "concurrently" in this context, even though it doesn't do so > anywhere else since the word isn't reser

Re: [GENERAL] undead index

2011-05-06 Thread Jens Wilke
On Friday 06 May 2011 18:08:58 Tom Lane wrote: > There doesn't appear to be any fix for this that doesn't require a time > machine and/or a lot more effort than it's worth. Isn't it possible to backport the fix for pg_get_indexdef() to 8.* ? > Suggest you rename > the index in the 8.4 database

Re: [GENERAL] undead index

2011-05-06 Thread Tom Lane
Jens Wilke writes: > On Friday 06 May 2011 18:08:58 Tom Lane wrote: >> There doesn't appear to be any fix for this that doesn't require a time >> machine and/or a lot more effort than it's worth. > Isn't it possible to backport the fix for pg_get_indexdef() to 8.* ? We could install a kluge (no

Re: [GENERAL] Growing a live database

2011-05-06 Thread Scott Marlowe
On Fri, May 6, 2011 at 7:27 AM, Rick Genter wrote: > I have a PostgreSQL 8.4.4 database that is running 24/7. The drive that the > database is on is becoming full and I need to expand it. We are currently > doing log-shipping of the WAL files to a slave system to run in a hot > standby mode. I hav

[GENERAL] performance of count(*)

2011-05-06 Thread Scott Ribe
I need to optimize queries that deal with some aggregates regarding resource availability. My specific problem is, I think, very closely analogous to select count(*)... where... I know roughly how to do it, aggregated stats table, triggers appending to it, occasional updates to coalesce entries

Re: [GENERAL] performance of count(*)

2011-05-06 Thread Tomas Vondra
Dne 6.5.2011 20:45, Scott Ribe napsal(a): > I need to optimize queries that deal with some aggregates regarding > resource availability. My specific problem is, I think, very closely > analogous to select count(*)... where... > > I know roughly how to do it, aggregated stats table, triggers > appe

Re: [GENERAL] performance of count(*)

2011-05-06 Thread Andrew Sullivan
On Fri, May 06, 2011 at 12:45:23PM -0600, Scott Ribe wrote: > I need to optimize queries that deal with some aggregates regarding resource availability. My specific problem is, I think, very closely analogous to select count(*)... where... If the WHERE clause is fairly selective and indexed,

[GENERAL] pgloader hangs with an invalid filename

2011-05-06 Thread Tony Capobianco
Has anyone experienced the behavior of pgloader hanging when the .conf file has an incorrect filename? When I execute with the correct filename, everything works just fine. However, when I use an incorrect filename, I get the below: PG_DB> pgloader -c hangs.pgload.conf -v pgloader INFO Log

Re: [GENERAL] Foreign key in composite values

2011-05-06 Thread David Johnston
In your example can you Make cx.r a foreign key on another table (say real) so that a valid instance of cx must have a value for r that exists in real? I guess you could make r an enum but that wouldn't readily allow you to modify the allowable values for r. A domain and/or check constraint fo

Re: [GENERAL] performance of count(*)

2011-05-06 Thread Scott Ribe
On May 6, 2011, at 1:39 PM, Tomas Vondra wrote: > Anyway I'd recommend to start with the eager approach, it's much easier > to implement. You can implement the lazy approach later, if you find out > it's needed. With the eager approach, I think I'm too likely to get write conflicts. Thanks for t

Re: [GENERAL] performance of count(*)

2011-05-06 Thread Andrew Sullivan
On Fri, May 06, 2011 at 03:43:02PM -0600, Scott Ribe wrote: > In this case, it depends on the result of a pretty complex join that > involves some gnarly time calculations, and finding the unmatched > rows from one side of an outer join. Yeah, in that case the HOT suggestions are very important.

Re: [GENERAL] performance of count(*)

2011-05-06 Thread Scott Ribe
On May 6, 2011, at 4:15 PM, Andrew Sullivan wrote: > Yeah, in that case the HOT suggestions are very important. I strongly > recomment you experiment in a test system with real data and > pathological cases in particular, in order to see what happens when > the outlier cases inevitably, Murphy wi

Re: [GENERAL] Cannot reproduce why a query is slow

2011-05-06 Thread pasman pasmański
Try auto_explain module. 2011/5/5, John Cheng : > Hi, > We have certain types of query that seems to take about 900ms to run > according to postgres logs. When I try to run the same query via > command line with "EXPLAIN ANALYZE", the query finishes very quickly. > What should I do to try to learn