[GENERAL] How can I group all children by their parent ?

2014-07-17 Thread Arup Rakshit
How can I group all children by their parent ?  id email parent_id 1 t...@test.com nil 2 te...@test.com 1 3 email 1 4 email 2 5 email nil 6 email 3   Regards, Arup Rakshit

Re: [GENERAL] How can I group all children by their parent ?

2014-07-17 Thread François Beausoleil
Le 2014-07-17 à 09:08, Arup Rakshit arupraks...@rocketmail.com a écrit : How can I group all children by their parent ? id email parent_id 1 t...@test.com nil 2 te...@test.com 1 3 email 1 4 email 2 5 email nil 6 email 3

Re: [GENERAL] How can I group all children by their parent ?

2014-07-17 Thread Pujol Mathieu
Le 17/07/2014 15:08, Arup Rakshit a écrit : How can I group all children by their parent ? id email parent_id 1 t...@test.com nil 2 te...@test.com 1 3 email 1 4 email 2 5 email nil 6 email 3 Regards, Arup Rakshit Did you mean SELECT array_agg(id), array_agg(email), parent_id FROM ... GROUP BY

Re: [GENERAL] How can I group all children by their parent ?

2014-07-17 Thread Arup Rakshit
ORDER BY parent_id, id ? François Beausoleil parent_id .. But why order_by.. I thought I need to group by parent child email  1      2        te...@test.com                 3        email

Re: [GENERAL] How can I group all children by their parent ?

2014-07-17 Thread David G Johnston
Arup Rakshit wrote ORDER BY parent_id, id ? François Beausoleil parent_id .. But why order_by.. I thought I need to group by parent child email  1      2         test1@                 3        email The word group as you have used it can mean: Generate a single record for each

Re: [GENERAL] How can I group all children by their parent ?

2014-07-17 Thread D'Arcy J.M. Cain
On Thu, 17 Jul 2014 21:28:14 +0800 Arup Rakshit arupraks...@rocketmail.com wrote: ORDER BY parent_id, id ? parent_id .. But why order_by.. I thought I need to group by Perhaps you need to tell us what your problem is instead of your solution. What exactly are you trying to accomplish here?

Re: [GENERAL] Why pg_toast table not get auto vacuumed?

2014-07-17 Thread Adrian Klaver
On 07/16/2014 12:05 PM, jlliu wrote: Hi, PostgreSQL version: 9.1.16. Linux: RHEL6. After a heavy traffic run, a huge pg_toast table is seen. Its size is ~3G. There also exist other pg_toast tables in a much smaller size, for example, ~100M. The problem is that that huge pg_toast table never

Re: [GENERAL] Windows Installation User account - Correct database for us

2014-07-17 Thread Wolfgang Keller
H2 or SQLite can be very reasonable choices for in-app embedded databases, so long as your app can operate within their constraints on concurrency and data size. Firefox uses SQLite and the places.sqlite database is notorious for getting corrupted every five minutes. Libreoffice/Openoffice

[GENERAL] Checkpoint_segments optimal value

2014-07-17 Thread Prabhjot Sheena
Hello All i had a database load issue today and when i was checking logs i saw this message. I m running postgresql 8.3 db::ts:2014-07-17 09:38:21 PDT::LOG: checkpoints are occurring too frequently (26 seconds apart) db::ts:2014-07-17 09:38:21 PDT::HINT: Consider increasing the

Re: [GENERAL] Checkpoint_segments optimal value

2014-07-17 Thread Potentialtech
On Thu, 17 Jul 2014 10:44:32 -0700 Prabhjot Sheena prabhjot.she...@rivalwatch.com wrote: Hello All i had a database load issue today and when i was checking logs i saw this message. I m running postgresql 8.3 db::ts:2014-07-17 09:38:21 PDT::LOG: checkpoints are occurring too

Re: [GENERAL] Checkpoint_segments optimal value

2014-07-17 Thread Tom Lane
Potentialtech wmo...@potentialtech.com writes: If the warning isn't happening too often, I would try increasing it only a little and see if it helps. If it's not enough you can then increase it some more. Various sources around the Internet suggest that you don't want to go much larger than

Re: [GENERAL] Checkpoint_segments optimal value

2014-07-17 Thread Prabhjot Sheena
Thanks i have changed that to 64 and reloaded it. When i had load issue today there was this exact same query that hits the db like 50 to 60 times from different machines in 3 to 4 minutes and was taking long time to execute and was holding up the database. i did recreate an index and it started

Re: [GENERAL] Checkpoint_segments optimal value

2014-07-17 Thread Potentialtech
On Thu, 17 Jul 2014 14:06:28 -0400 Tom Lane t...@sss.pgh.pa.us wrote: Potentialtech wmo...@potentialtech.com writes: If the warning isn't happening too often, I would try increasing it only a little and see if it helps. If it's not enough you can then increase it some more. Various

Re: [GENERAL] Checkpoint_segments optimal value

2014-07-17 Thread Potentialtech
On Thu, 17 Jul 2014 11:28:04 -0700 Prabhjot Sheena prabhjot.she...@rivalwatch.com wrote: Thanks i have changed that to 64 and reloaded it. When i had load issue today there was this exact same query that hits the db like 50 to 60 times from different machines in 3 to 4 minutes and was

[GENERAL] Whats is lock type transactionid?

2014-07-17 Thread AI Rumman
Hi, I have been facing lock contention in my Postgresql 9.1 DB. And when I am querying in the pg_locks table I found a lock type with transactionid. Could someone please tell me what it means? Thanks.

Re: [GENERAL] Whats is lock type transactionid?

2014-07-17 Thread Douglas J Hunley
On Thu, Jul 17, 2014 at 3:34 PM, AI Rumman rumman...@gmail.com wrote: Hi, I have been facing lock contention in my Postgresql 9.1 DB. And when I am querying in the pg_locks table I found a lock type with transactionid. Could someone please tell me what it means? Thanks. from

Re: [GENERAL] Whats is lock type transactionid?

2014-07-17 Thread AI Rumman
I am experiencing lock contention on one single UPDATE statement at a certain time in whole day. This is a small table to UPDATE. My suspect is we are facing it for one specific ID. Could you please let me know how can I identify the tuple. I got a log like follows: blocker_target

Re: [GENERAL] Whats is lock type transactionid?

2014-07-17 Thread Douglas J Hunley
On Thu, Jul 17, 2014 at 12:54 PM, AI Rumman rumman...@gmail.com wrote: I am experiencing lock contention on one single UPDATE statement at a certain time in whole day. This is a small table to UPDATE. My suspect is we are facing it for one specific ID. Could you please let me know how can I

[GENERAL] Detect streaming replication failure

2014-07-17 Thread Lists
For reference: https://wiki.postgresql.org/wiki/Streaming_Replication Assume a master - slave streaming replication configuration, Postgresql 9.2. Assume that the master has been chugging away, but the slave PG service has been offline for a while and the wal archive has updated enough that

Re: [GENERAL] Whats is lock type transactionid?

2014-07-17 Thread AI Rumman
Yes. But as we are using bind variables, we are not able to get the ID of the tuple. On Thu, Jul 17, 2014 at 2:08 PM, Douglas J Hunley doug.hun...@gmail.com wrote: On Thu, Jul 17, 2014 at 12:54 PM, AI Rumman rumman...@gmail.com wrote: I am experiencing lock contention on one single UPDATE

Re: [GENERAL] Checkpoint_segments optimal value

2014-07-17 Thread Prabhjot Sheena
Here is the explain plan. There query time went backup up to 2 to 3 minutes from 3 second in just 2 hrs. Can anyone suggest something on how to fix this or why this is happening explain SELECT account.id, account.organization_id, run.application_id, work_unit.script, work_unit.id,

Re: [GENERAL] Checkpoint_segments optimal value

2014-07-17 Thread Prabhjot Sheena
even though the explain plan suggests differently but its taking long long time On Thu, Jul 17, 2014 at 4:26 PM, Prabhjot Sheena prabhjot.she...@rivalwatch.com wrote: Here is the explain plan. There query time went backup up to 2 to 3 minutes from 3 second in just 2 hrs. Can anyone

Re: [GENERAL] Checkpoint_segments optimal value

2014-07-17 Thread John R Pierce
On 7/17/2014 4:26 PM, Prabhjot Sheena wrote: Here is the explain plan. There query time went backup up to 2 to 3 minutes from 3 second in just 2 hrs. Can anyone suggest something on how to fix this or why this is happening explain SELECT account.id http://account.id,

Re: [GENERAL] Checkpoint_segments optimal value

2014-07-17 Thread John R Pierce
On 7/17/2014 11:28 AM, Prabhjot Sheena wrote: SELECT account.id http://account.id, account.organization_id, run.application_id, work_unit.script, work_unit.id http://work_unit.id, work_unit.start_time, run.id http://run.id, work_unit.priority FROM work_unit, run, account WHERE

Re: [GENERAL] Checkpoint_segments optimal value

2014-07-17 Thread Prabhjot Sheena
i just did explain analyze and currently database is running slow coz of the query explain ANALYZE SELECT account.id, account.organization_id, run.application_id, work_unit.script, work_unit.id, work_unit.start_time, run.id, work_unit.priority FROM work_unit, run, account WHERE work_unit.status

Re: [GENERAL] Checkpoint_segments optimal value

2014-07-17 Thread John R Pierce
On 7/17/2014 5:01 PM, Prabhjot Sheena wrote: i just did explain analyze and currently database is running slow coz of the query explain ANALYZE SELECT account.id http://account.id, account.organization_id, run.application_id, work_unit.script, work_unit.id http://work_unit.id,

Re: [GENERAL] Windows Installation User account - Correct database for us

2014-07-17 Thread Adrian Klaver
On 07/17/2014 07:30 AM, Wolfgang Keller wrote: H2 or SQLite can be very reasonable choices for in-app embedded databases, so long as your app can operate within their constraints on concurrency and data size. Firefox uses SQLite and the places.sqlite database is notorious for getting corrupted

Re: [GENERAL] Checkpoint_segments optimal value

2014-07-17 Thread Prabhjot Sheena
The overall load of system is good. It is a vm but the other database is running normal and not doing much activity vmstat 5 10 procs ---memory-- ---swap-- -io --system-- -cpu-- r b swpd free buff cache si sobibo in cs us sy id wa st 0 2

Re: [GENERAL] Checkpoint_segments optimal value

2014-07-17 Thread John R Pierce
On 7/17/2014 5:36 PM, Prabhjot Sheena wrote: The overall load of system is good. It is a vm but the other database is running normal and not doing much activity other database? is that on the same postgresql cluster? or on a seperate instance of the postgres server on the same VM? or on

Re: [GENERAL] Detect streaming replication failure

2014-07-17 Thread wd
you can run select * from pg_stat_replication on master to check all the salve stats. On Fri, Jul 18, 2014 at 6:50 AM, Lists li...@benjamindsmith.com wrote: For reference: https://wiki.postgresql.org/wiki/Streaming_Replication Assume a master - slave streaming replication configuration,

[GENERAL] Watching Views

2014-07-17 Thread Nick Guenther
Dear List, I am interested in replicating views of my data in real time to a frontend visualizer. I've looked around, and it seems that most applications in this direction write some ad-hoc json-formatter that spits out exactly the columns it is interested in. I want something more like

Re: [GENERAL] Watching Views

2014-07-17 Thread David G Johnston
Nick Guenther wrote Dear List, I am interested in replicating views of my data in real time to a frontend visualizer. I've looked around, and it seems that most applications in this direction write some ad-hoc json-formatter that spits out exactly the columns it is interested in. I