[GENERAL] search_path reset on error (making it not reset)

2012-07-20 Thread imagene...@gmail.com
The search_path set for the connection is being reset if a query errors. Is there a setting to maintain the search_path despite errors.

[GENERAL] High CPU on read-only streaming replication server

2012-07-20 Thread Nick
My read-only streaming replication servers are showing a much higher CPU load than I would expect. None of my queries are longer than 10ms. My application server is connecting to this server via pgbouncer. Other than that, its a pretty standard setup. I haven't toyed with too many settings besid

Re: [GENERAL] High CPU on read-only streaming replication server

2012-07-20 Thread Nick
BTW, Its version 9.1.4 on a 2.2Ghz dual processor with 17GB of ram. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Get DB Size by row

2012-07-20 Thread Benjamin Adams
Hello, I'm looking to do something like: select month, mb_size(description) from data where year = 2012 group by month I also am looking for raw size not compressed size. Thanks Ben -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: ht

Re: [GENERAL] Pg_ctl promote -- wait for slave to be promoted fully ?

2012-07-20 Thread Chris Angelico
On Sat, Jul 21, 2012 at 5:28 AM, Manoj Govindassamy wrote: > -- Anyway I can query the state of DB to know its status slave or master ?? > So, that i can issue write statements only after I know that the DB is the > new master now Yep. Use pg_is_in_recovery() - it's false on the master, true on s

Re: [GENERAL] Select Rows With Only One of Two Values

2012-07-20 Thread Chris Angelico
On Sat, Jul 21, 2012 at 6:52 AM, Alban Hertroys wrote: > I don't think the DISTINCT is necessary there, doesn't EXCEPT already return > a distinct set, just like UNION (hence the existence of UNION ALL)? > > It can also be written as a correlated subquery: Oops, yes. I usually use UNION ALL and

Re: [GENERAL] big database resulting in small dump

2012-07-20 Thread Craig Ringer
On 07/21/2012 02:05 AM, Ilya Ivanov wrote: I have a 8.4 database (installed on ubuntu 10.04 x86_64). It holds Zabbix database. The database on disk takes 10Gb. SQL dump takes only 2Gb. I've gone through http://archives.postgresql.org/pgsql-general/2008-08/msg00316.php and got some hints. Natur

Re: [GENERAL] A Better Way? (Multi-Left Join Lookup)

2012-07-20 Thread David Johnston
> -Original Message- > From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general- > ow...@postgresql.org] On Behalf Of Tom Lane > Sent: Friday, July 20, 2012 6:51 PM > To: David Johnston > Cc: pgsql-general@postgresql.org > Subject: Re: [GENERAL] A Better Way? (Multi-Left Join Lookup)

Re: [GENERAL] A Better Way? (Multi-Left Join Lookup)

2012-07-20 Thread Tom Lane
"David Johnston" writes: >> From: Tom Lane [mailto:t...@sss.pgh.pa.us] >> Surely not. Neither merge nor hash joins require an index. What plan is >> getting selected? > I have attached a scrubbed query and explain/analyze. Let me know if > something more is needed. Well, here's your problem:

Re: [GENERAL] I cannot insert bengali character in UTF8

2012-07-20 Thread AI Rumman
WOW. Great informative answer. Thanks. On Fri, Jul 20, 2012 at 7:11 PM, Christian Ullrich wrote: > * AI Rumman wrote: > > I am using database with UTF8 and LC_CTYPE set as default value in >> Postgresql 9.1. >> But I cannot insert bengali character in a column. >> >> Query Failed:INSERT into tra

Re: [GENERAL] A Better Way? (Multi-Left Join Lookup)

2012-07-20 Thread David Johnston
> -Original Message- > From: Alban Hertroys [mailto:haram...@gmail.com] > Sent: Friday, July 20, 2012 5:03 PM > To: David Johnston > Cc: pgsql-general@postgresql.org > Subject: Re: [GENERAL] A Better Way? (Multi-Left Join Lookup) > > On 20 Jul 2012, at 22:30, David Johnston wrote: > > > H

Re: [GENERAL] A Better Way? (Multi-Left Join Lookup)

2012-07-20 Thread David Johnston
> -Original Message- > From: Tom Lane [mailto:t...@sss.pgh.pa.us] > Sent: Friday, July 20, 2012 4:47 PM > To: David Johnston > Cc: pgsql-general@postgresql.org > Subject: Re: [GENERAL] A Better Way? (Multi-Left Join Lookup) > > "David Johnston" writes: > > WITH > > full_set AS ( ) -- 8,

Re: [GENERAL] A Better Way? (Multi-Left Join Lookup)

2012-07-20 Thread Alban Hertroys
On 20 Jul 2012, at 22:30, David Johnston wrote: > Hi! > > Can someone please point me to a resource (or suggest a solution) that will > improve the performance of this query? I have some thoughts but figure I > should avoid reinventing the wheel since this seems like something that has > to

Re: [GENERAL] Select Rows With Only One of Two Values

2012-07-20 Thread Alban Hertroys
On 20 Jul 2012, at 18:15, Chris Angelico wrote: > On Sat, Jul 21, 2012 at 1:53 AM, Rich Shepard > wrote: >> The table has a Boolean indicator column with values of 0 or 1 for each >> row in the table and another attribute column for parameter names. I need to >> find all parameter names where t

Re: [GENERAL] A Better Way? (Multi-Left Join Lookup)

2012-07-20 Thread Tom Lane
"David Johnston" writes: > WITH > full_set AS ( ) -- 8,500 records > , sub_1 AS () -- also about 8,500 > , sub_2 AS () -- maybe 5,000 > , sub_3 AS () - - maybe 3,000 > SELECT full_set.* > , COALESCE(sub_1.field, FALSE) > , COALESCE(sub_2.field, FALSE) > , COALESCE(sub_2.field, FALSE) > FROM ful

[GENERAL] A Better Way? (Multi-Left Join Lookup)

2012-07-20 Thread David Johnston
Hi! Can someone please point me to a resource (or suggest a solution) that will improve the performance of this query? I have some thoughts but figure I should avoid reinventing the wheel since this seems like something that has to have been solved already. I am working on a query where

[GENERAL] Pg_ctl promote -- wait for slave to be promoted fully ?

2012-07-20 Thread Manoj Govindassamy
Hi team, I am using PG 9.1.2 and I am promoting a slave to master with the following command. pg_ctl promote -D /pat/to/data Command does return back faster with code 0 ( = success). I assumed the slave is now the master and issued write operations. But the statement failed as the DB compla

Re: [GENERAL] big database resulting in small dump

2012-07-20 Thread Tom Lane
Ilya Ivanov writes: > well, it'd be good to have a link to the resource that says about 5x ratio, > but in general I'm satisfied with that explanation. Thank you. [ digs around ... ] It's at the bottom of this page: http://www.postgresql.org/docs/9.1/static/install-requirements.html which I wil

Re: [GENERAL] big database resulting in small dump

2012-07-20 Thread Ilya Ivanov
well, it'd be good to have a link to the resource that says about 5x ratio, but in general I'm satisfied with that explanation. Thank you.

Re: [GENERAL] big database resulting in small dump

2012-07-20 Thread Lonni J Friedman
On Fri, Jul 20, 2012 at 11:23 AM, Tom Lane wrote: > Lonni J Friedman writes: >> On Fri, Jul 20, 2012 at 11:05 AM, Ilya Ivanov wrote: >>> I have a 8.4 database (installed on ubuntu 10.04 x86_64). It holds Zabbix >>> database. The database on disk takes 10Gb. SQL dump takes only 2Gb. > >> Its not

Re: [GENERAL] big database resulting in small dump

2012-07-20 Thread Tom Lane
Lonni J Friedman writes: > On Fri, Jul 20, 2012 at 11:05 AM, Ilya Ivanov wrote: >> I have a 8.4 database (installed on ubuntu 10.04 x86_64). It holds Zabbix >> database. The database on disk takes 10Gb. SQL dump takes only 2Gb. > Its not entirely clear what behavior you expect here. Assuming th

Re: [GENERAL] big database resulting in small dump

2012-07-20 Thread Lonni J Friedman
On Fri, Jul 20, 2012 at 11:05 AM, Ilya Ivanov wrote: > I have a 8.4 database (installed on ubuntu 10.04 x86_64). It holds Zabbix > database. The database on disk takes 10Gb. SQL dump takes only 2Gb. I've > gone through > http://archives.postgresql.org/pgsql-general/2008-08/msg00316.php and got > s

[GENERAL] big database resulting in small dump

2012-07-20 Thread Ilya Ivanov
I have a 8.4 database (installed on ubuntu 10.04 x86_64). It holds Zabbix database. The database on disk takes 10Gb. SQL dump takes only 2Gb. I've gone through http://archives.postgresql.org/pgsql-general/2008-08/msg00316.php and got some hints. Naturally, the biggest table is history (the second b

Re: [GENERAL] Select Rows With Only One of Two Values [RESOLVED]

2012-07-20 Thread Thomas Kellerer
Chris Angelico wrote on 20.07.2012 18:25: I don't know how hard it'd be to make it work on Postgres, but here's an epic piece of SQL awesomeness: http://thedailywtf.com/Articles/Stupid-Coding-Tricks-The-TSQL-Madlebrot.aspx That has already been done - and much cleaner I think ;) https://wiki.

Re: [GENERAL] Select Rows With Only One of Two Values [RESOLVED]

2012-07-20 Thread Andreas Kretschmer
Chris Angelico wrote: > No probs! SQL, like many other languages, allows you to combine its > primitives in some fairly complex ways. I don't know how hard it'd be > to make it work on Postgres, but here's an epic piece of SQL > awesomeness: > > http://thedailywtf.com/Articles/Stupid-Coding-Tric

Re: [GENERAL] Select Rows With Only One of Two Values [RESOLVED]

2012-07-20 Thread Chris Angelico
On Sat, Jul 21, 2012 at 2:21 AM, Rich Shepard wrote: > On Sat, 21 Jul 2012, Chris Angelico wrote: > >> Try this: >> >> SELECT DISTINCT param FROM table WHERE indicator=0 >> EXCEPT >> SELECT DISTINCT param FROM table WHERE indicator=1 > > > Chris, > > Thank you. I knew it was simple, and I've not

Re: [GENERAL] Select Rows With Only One of Two Values [RESOLVED]

2012-07-20 Thread Rich Shepard
On Sat, 21 Jul 2012, Chris Angelico wrote: Try this: SELECT DISTINCT param FROM table WHERE indicator=0 EXCEPT SELECT DISTINCT param FROM table WHERE indicator=1 Chris, Thank you. I knew it was simple, and I've not before used the EXCEPT condition. Very much appreciate, Rich -- Sent vi

Re: [GENERAL] Select Rows With Only One of Two Values

2012-07-20 Thread Chris Angelico
On Sat, Jul 21, 2012 at 1:53 AM, Rich Shepard wrote: > The table has a Boolean indicator column with values of 0 or 1 for each > row in the table and another attribute column for parameter names. I need to > find all parameter names where the indicator value is only 0 for all rows of > that para

[GENERAL] Select Rows With Only One of Two Values

2012-07-20 Thread Rich Shepard
What I thought would be a simple, single table select keeps eluding me. I've looked in Rick van der Laans' book and the Joe Celko books here and have not learned how to write the query. The table has a Boolean indicator column with values of 0 or 1 for each row in the table and another attrib

Re: [GENERAL] I cannot insert bengali character in UTF8

2012-07-20 Thread Christian Ullrich
* AI Rumman wrote: I am using database with UTF8 and LC_CTYPE set as default value in Postgresql 9.1. But I cannot insert bengali character in a column. Query Failed:INSERT into tracker (user_id, module_name, item_id, item_summary) values ('1','Leads','353','বাংলা টেস্��...')::ADODB error::->ER

Re: [GENERAL] I cannot insert bengali character in UTF8

2012-07-20 Thread Peter Geoghegan
On 20 July 2012 11:30, AI Rumman wrote: > I am using database with UTF8 and LC_CTYPE set as default value in > Postgresql 9.1. > But I cannot insert bengali character in a column. > > Query Failed:INSERT into tracker (user_id, module_name, item_id, > item_summary) values ('1','Leads','353','বাংলা

Re: [GENERAL] data from the table is getting dropped when I am restarting my application after making changes in the objects created in my application in play

2012-07-20 Thread Craig Ringer
On 07/20/2012 05:54 PM, Roshan Saxena wrote: Yes it is connect and insertion and udation and deletion is taking place normally but the proble of table drop occurs when I make any changes in my models in play Please reply to the mailing list (reply all) not to me directly. If Play framework is

[GENERAL] I cannot insert bengali character in UTF8

2012-07-20 Thread AI Rumman
I am using database with UTF8 and LC_CTYPE set as default value in Postgresql 9.1. But I cannot insert bengali character in a column. Query Failed:INSERT into tracker (user_id, module_name, item_id, item_summary) values ('1','Leads','353','বাংলা টেস্��...')::ADODB error::->ERROR: invalid byte sequ

Re: [GENERAL] Problem setting environmental variables for postgresql or plpythonu

2012-07-20 Thread Albe Laurenz
Mark Wynter wrote: > I''m hoping someone can help me out. I'm wanting to run GRASS GIS from within a plpythonu function > block. But to run GRASS GIS externally, the following environmental variables need to be available to > the Postgresql server... [...] > So far I've added these variables t

Re: [GENERAL] How to stop a query

2012-07-20 Thread Martin French
As Scott mentioned, kill -9 on a Postgres process is not a wise idea on a Postgres process.If you query is coming from another application, then terminating that application with a kill -9 *may* work, but is, as scott says, a last resortI tend to use kill -TERM (15) to disconnect the client, which