[GENERAL] Recommended replication solution?

2010-12-17 Thread Marcin Krol
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello everyone, Yes I know, "size one not fits all", I specifically need: * preferably multi-master * local read, cluster-wide write * a solution that allows me to maintain consistency between masters in case of single node failure * last but not

[GENERAL] Linux: PAE or x64

2010-12-15 Thread Marcin Krol
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello, I'll use PG on a dedicated machine with more than 4GB of memory. The problem is: what would be better to use: PAE ("bigmem" kernels) or 64-bit kernel? PAE pro: half the memory per pointer, int, etc. PAE risk: is PG able to take advantage of

[GENERAL] The REAL cost of joins

2010-03-03 Thread Marcin Krol
Hello everyone, I have inadvertently set off a furball on an unrelated ng on what is the actual cost of SQL joins. But there's no reliable conclusion. I would like to actually know that, that is, are JOINs truly expensive? As they say, one measurement is worth a thousand opinions, so I've don

Re: [GENERAL] vacuum analyze GROWS db ?!

2010-02-15 Thread Marcin Krol
Tom Lane wrote: Do you *know* that relpages was up to date before that? If your system only does manual vacuums then those numbers probably reflected reality as of your last vacuum. There are functions that will give you true file sizes but relpages ain't it. Oh great. Another catch. What are

[GENERAL] Selection of index for CLUSTER

2010-02-15 Thread Marcin Krol
Hello everyone, Is there some guideline for selection of index to use for CLUSTER? This is rather important as physical table is reorganized according to that index I gather? The docs are mute on this. The docs recommend running ANALYZE on the table. hrs=# ANALYZE VERBOSE hosts; INFO: analy

[GENERAL] CLUSTER cannot complete

2010-02-15 Thread Marcin Krol
Hello everyone, Resolved, I've done: hrs=# CLUSTER hosts_ip_idx ON hosts; CLUSTER hrs=# hrs=# hrs=# SELECT relpages * 8192 AS size_in_bytes, relname FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'public') ORDER BY size_in_bytes DESC LIMIT 10; size_in_bytes

[GENERAL] CLUSTER cannot complete

2010-02-15 Thread Marcin Krol
Hello everyone, I got this, first CLUSTER was hanging forever, I cancelled after half an hour: hrs=# CLUSTER hosts; Cancel request sent ERROR: canceling statement due to user request Then I restarted postgres and get this now: hrs=# CLUSTER hosts; ERROR: there is no previously clustered

[GENERAL] vacuum analyze GROWS db ?!

2010-02-15 Thread Marcin Krol
Hello everyone, The app that created this db is written by me for a change. But I've done simple VACUUM ANALYZE on the biggest table in db and got this: before VACUUM ANALYZE: hrs=# SELECT relpages * 8192 AS size_in_bytes, relname FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_names

Re: [GENERAL] db size and VACUUM ANALYZE

2010-02-12 Thread Marcin Krol
Bill Moran wrote: Note that the "correct" disk size for your database is probably closer to the 1.6G you were seeing before. This might be the case, but how do I find out what are the "correct" sizes? I have a script that does following queries: SELECT relpages * 8192 AS size_in_bytes, reln

Re: [GENERAL] db size and VACUUM ANALYZE

2010-02-12 Thread Marcin Krol
Amitabh Kant wrote: You need to do VACUUM FULL ANALYZE to claim the disk space, but this creates a exclusive lock on the tables. See http://www.postgresql.org/docs/8.3/static/sql-vacuum.html Aha! OK but why did the performance degrade so much? The same reason -- lack of autovacuuming/vacuum

[GENERAL] db size and VACUUM ANALYZE

2010-02-12 Thread Marcin Krol
Hello, The db in the application I maintain but didn't write (it obviously makes use of PG, v 8.3), has been systematically growing in size from about 600M to 1.6G. At the same time, the performance of the app has degraded significantly (several times). So I've done VACUUM ANALYZE on entire db.

[GENERAL] retrieving primary key for row with MIN function

2009-04-30 Thread Marcin Krol
Hello everyone, I need to retrieve PK (r.id in the query) for row with MIN(r.start_date), but with a twist: I need to select only one record, the one with minimum date. Doing it like this does not solve the problem: SELECT h.id AS host_id, MIN(r.start_date) AS reservation_start_date, r.id A

Re: [GENERAL] complicated query (newbie..)

2009-04-10 Thread Marcin Krol
Thanks a lot, Sam (and others), thanks to your help I managed to finally produce the query I wanted. Regards, mk -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] complicated query (newbie..)

2009-04-09 Thread Marcin Krol
Sam Mason wrote: On Thu, Apr 09, 2009 at 07:25:42PM +0200, Marcin Krol wrote: Sam Mason wrote: This is a big hint that things are going wrong. You need those quotes in there, an "integer" is a plain number and not a date. This one does work in the sense of selecting out the wrong h

Re: [GENERAL] complicated query (newbie..)

2009-04-09 Thread Marcin Krol
e responsabilité pour le contenu fourni. > Date: Thu, 9 Apr 2009 18:08:04 +0200 > From: mrk...@gmail.com > To: s...@samason.me.uk > CC: pgsql-general@postgresql.org > Subject: Re: [GENERAL] complicated query (newbie..) > > Sam Mason wrote: > > On Thu, Apr 09, 2009 a

Re: [GENERAL] complicated query (newbie..)

2009-04-09 Thread Marcin Krol
Sam Mason wrote: This is a big hint that things are going wrong. You need those quotes in there, an "integer" is a plain number and not a date. This one does work in the sense of selecting out the wrong host but it still produces nothing but NULLs! SELECT h.id, r.id, r.start_date, r.end_da

Re: [GENERAL] complicated query (newbie..)

2009-04-09 Thread Marcin Krol
Hello Sam, Thanks a million for reply! I'm so frustrated with this.. Sam Mason wrote: On Thu, Apr 09, 2009 at 06:08:04PM +0200, Marcin Krol wrote: What I'm trying to accomplish is producing list of hosts available within a specified timeframe. What I have is a table of hosts

[GENERAL] ON condition in LEFT OUTER JOIN doesn't work?!

2009-04-09 Thread Marcin Krol
Hello everyone, I've got this query: SELECT hosts.id, MIN(reservation.start_date) FROM hosts LEFT OUTER JOIN reservation_hosts ON reservation_hosts.host_id = hosts.id LEFT OUTER JOIN reservation ON (reservation_hosts.reservation_id = reservation.id AND reservation.start_date > 2009-04-09) GROU

Re: [GENERAL] complicated query (newbie..)

2009-04-09 Thread Marcin Krol
Sam Mason wrote: On Thu, Apr 09, 2009 at 04:47:32PM +0200, Marcin Krol wrote: I've got 3 tables: hosts (with host.id column) and reservation (with reservation.id column) in many-to-many relation, and reservation_hosts which is an association table (with reservation_id and host_id co

Re: [GENERAL] complicated query (newbie..)

2009-04-09 Thread Marcin Krol
Hello Aurimas, Thanks for answer! Do you need a MIN(start_date) for each host you get from the query before last join? Yes, I really do - the idea is that from several reservations fulfilling the dates condition the earliest reservation has to be selected (i.e. the one with minimum start da

[GENERAL] complicated query (newbie..)

2009-04-09 Thread Marcin Krol
Hello everyone, I've got 3 tables: hosts (with host.id column) and reservation (with reservation.id column) in many-to-many relation, and reservation_hosts which is an association table (with reservation_id and host_id columns). So I've got this query which selects hosts and reservations unde

[GENERAL] weird problem with PG 8.1

2009-03-31 Thread Marcin Krol
Hello everyone, I'm having this completely weird problem that ORDER BY doesn't seem to work correctly in PG 8.1 as bundled in RedHat 5. When I issue: SELECT * FROM virtualization; I get all the fields: reservations=# SELECT * FROM virtualization; id | Virtualization | color +