Re: [GENERAL] Need some help in postgres locking mechanism

2014-04-15 Thread santhosh kumar
Hi I am locking some rows using select for update(nowait=true) inside a transaction.If server in which code exists crashes,locks will be on rows.Those should be removed manually.I donot want that.I want to keep a timeout for that transaction.Could you please helpme out with a solution for this issu

Re: [GENERAL] Need some help in postgres locking mechanism

2014-04-08 Thread santhosh kumar
Thanks alot..i have implemented in same format.You people are awesome.Thank You once again On Tue, Apr 8, 2014 at 8:58 PM, Hannes Erven wrote: > Hi, > > > On 2014-04-08 15:27, Vick Khera wrote: > [...] > > Problem 2: you cannot have a second process skip over locked rows. >> > > > In fact, you

Re: [GENERAL] Need some help in postgres locking mechanism

2014-04-08 Thread Vick Khera
On Tue, Apr 8, 2014 at 11:28 AM, Hannes Erven wrote: > On 2014-04-08 15:27, Vick Khera wrote: > [...] >> >> Problem 2: you cannot have a second process skip over locked rows. > > > > In fact, you can: use "FOR UPDATE NOWAIT" and catch any errors. > > e.g. SELECT * FROM jobqueue WHERE id=? FOR UPDA

Re: [GENERAL] Need some help in postgres locking mechanism

2014-04-08 Thread Hannes Erven
Hi, On 2014-04-08 15:27, Vick Khera wrote: [...] Problem 2: you cannot have a second process skip over locked rows. In fact, you can: use "FOR UPDATE NOWAIT" and catch any errors. e.g. SELECT * FROM jobqueue WHERE id=? FOR UPDATE NOWAIT -hannes -- Sent via pgsql-general mailing list (p

Re: [GENERAL] Need some help in postgres locking mechanism

2014-04-08 Thread Vick Khera
Problem 1: how (and why) are you locking rows in table Y? Problem 2: you cannot have a second process skip over locked rows. It sounds to me like a job queue... what you want to do is make it work *really* fast to mark the job as taken and commit that work so the locks are released. Then go do the

[GENERAL] Need some help in postgres locking mechanism

2014-04-03 Thread santhosh kumar
Hi I have two problems to discuss.an you please guide me how to proceed on this. *problem 1:* I have table X('a' is prmiary key) and table Y('b' is primary key). Table Y has ''a''(X primary key) as foreign key.I have one job which runs once in one hour.I want to lock the rows in table Y.but this wi

Re: [GENERAL] Need some help on Performance 9.0.4

2013-10-18 Thread Tomas Vondra
Hi, On 18 Říjen 2013, 17:06, akp geek wrote: > when I issue the top command on solaris, what ever I have posted is > exactly > getting. > > top -n > load averages: 11.4, 10.8, 10.2;up 680+21:31:46 > 15:05:21 > 137 processes: 123 sleeping, 14 on cpu > CPU states: 82.0% idle,

Re: [GENERAL] Need some help on Performance 9.0.4

2013-10-17 Thread Tomas Vondra
On 17.10.2013 20:56, akp geek wrote: > got the output from depesz and this the top on the system. thanks for > the help .. >From depesz? That site works differently - you enter the explain plan into the form, it does some formatting/highlighting and you're supposed to submit the link to that pag

Re: [GENERAL] Need some help on Performance 9.0.4

2013-10-13 Thread Tomas Vondra
Hi, On 13.10.2013 17:43, akp geek wrote: > Sorry all not posting clear. I posted our postresql.conf file. What > we are having is very slow response from the database. > > would like to get some feedback about postgresql.conf file > parameters that I posted are causing the issue for performance

Re: [GENERAL] Need some help on Performance 9.0.4

2013-10-13 Thread bricklen
On Sun, Oct 13, 2013 at 8:43 AM, akp geek wrote: > Sorry all not posting clear. I posted our postresql.conf file. What we > are having is very slow response from the database. > > would like to get some feedback about postgresql.conf file parameters that > I posted are causing the issue for perf

Re: [GENERAL] Need some help on Performance 9.0.4

2013-10-13 Thread akp geek
Sorry all not posting clear. I posted our postresql.conf file. What we are having is very slow response from the database. would like to get some feedback about postgresql.conf file parameters that I posted are causing the issue for performance of the DB. Our database is about 60GB and performan

Re: [GENERAL] Need some help on Performance 9.0.4

2013-10-12 Thread Michael Paquier
On Sat, Oct 12, 2013 at 12:56 AM, akp geek wrote: > We have been running 4 of our applications on 9.0.4, which we are planning > to update the database 9.2.2 by the year end. we have the streaming > replication also running 9.2.4 has fixed a severe security problem. If you do not want to expose yo

Re: [GENERAL] Need some help on Performance 9.0.4

2013-10-11 Thread John R Pierce
On 10/11/2013 8:56 AM, akp geek wrote: We have been running 4 of our applications on 9.0.4, which we are planning to update the database 9.2.2 9.0 is currently at 9.0.14, and 9.2 is currently at 9.2.5. -- john r pierce 37N 122W somewhere on the middle of

Re: [GENERAL] Need some help on Performance 9.0.4

2013-10-11 Thread John R Pierce
On 10/11/2013 9:34 AM, akp geek wrote: thanks for the help whats the question?you list what you're doing, and give a snapshot of your system state while doing some unspecified tasks. -- john r pierce 37N 122W somewhere on the middle of the left coas

Re: [GENERAL] Need some help on Performance 9.0.4

2013-10-11 Thread Steve Crawford
On 10/11/2013 08:56 AM, akp geek wrote: We have been running 4 of our applications on 9.0.4, which we are planning to update the database 9.2.2 by the year end Sorry if I missed it but I couldn't find a question or description of a problem you are encountering. Cheers, Steve -- Sent v

Re: [GENERAL] Need some help setting up pgAgent

2010-10-18 Thread Mike Christensen
On Mon, Oct 18, 2010 at 3:37 AM, Dave Page wrote: > On Mon, Oct 18, 2010 at 11:34 AM, Mike Christensen wrote: >> On Mon, Oct 18, 2010 at 3:07 AM, Dave Page wrote: >>> On Mon, Oct 18, 2010 at 10:46 AM, Mike Christensen >>> wrote: Okay I found one that I can use.. One question..  

Re: [GENERAL] Need some help setting up pgAgent

2010-10-18 Thread Mike Christensen
On Mon, Oct 18, 2010 at 3:07 AM, Dave Page wrote: > On Mon, Oct 18, 2010 at 10:46 AM, Mike Christensen wrote: >> Okay I found one that I can use.. >> >> One question..  Should the connection string in the script have the >> password for "root" hard coded in it?  Or will it use a password from >>

Re: [GENERAL] Need some help setting up pgAgent

2010-10-18 Thread Dave Page
On Mon, Oct 18, 2010 at 11:34 AM, Mike Christensen wrote: > On Mon, Oct 18, 2010 at 3:07 AM, Dave Page wrote: >> On Mon, Oct 18, 2010 at 10:46 AM, Mike Christensen >> wrote: >>> Okay I found one that I can use.. >>> >>> One question..  Should the connection string in the script have the >>> pas

Re: [GENERAL] Need some help setting up pgAgent

2010-10-18 Thread Dave Page
On Mon, Oct 18, 2010 at 10:46 AM, Mike Christensen wrote: > Okay I found one that I can use.. > > One question..  Should the connection string in the script have the > password for "root" hard coded in it?  Or will it use a password from > ~/.pgpass automatically?  If so, what user account will it

Re: [GENERAL] Need some help setting up pgAgent

2010-10-18 Thread Mike Christensen
On Mon, Oct 18, 2010 at 2:43 AM, Dave Page wrote: > On Mon, Oct 18, 2010 at 10:41 AM, Mike Christensen wrote: >> On Mon, Oct 18, 2010 at 2:34 AM, Dave Page wrote: >>> On Mon, Oct 18, 2010 at 10:31 AM, Mike Christensen >>> wrote: Sorry, it looks like it defaulted to the wrong DB.  I create

Re: [GENERAL] Need some help setting up pgAgent

2010-10-18 Thread Dave Page
On Mon, Oct 18, 2010 at 10:41 AM, Mike Christensen wrote: > On Mon, Oct 18, 2010 at 2:34 AM, Dave Page wrote: >> On Mon, Oct 18, 2010 at 10:31 AM, Mike Christensen >> wrote: >>> Sorry, it looks like it defaulted to the wrong DB.  I created the >>> schema in the "postgres" database and now I see

Re: [GENERAL] Need some help setting up pgAgent

2010-10-18 Thread Mike Christensen
On Mon, Oct 18, 2010 at 2:34 AM, Dave Page wrote: > On Mon, Oct 18, 2010 at 10:31 AM, Mike Christensen wrote: >> Sorry, it looks like it defaulted to the wrong DB.  I created the >> schema in the "postgres" database and now I see a Jobs node.. > > :-) > >> One last question - How do I configure p

Re: [GENERAL] Need some help setting up pgAgent

2010-10-18 Thread Dave Page
On Mon, Oct 18, 2010 at 10:31 AM, Mike Christensen wrote: > Sorry, it looks like it defaulted to the wrong DB.  I created the > schema in the "postgres" database and now I see a Jobs node.. :-) > One last question - How do I configure pgAgent to start automatically? You'll need to put together

Re: [GENERAL] Need some help setting up pgAgent

2010-10-18 Thread Mike Christensen
On Mon, Oct 18, 2010 at 2:21 AM, Mike Christensen wrote: > On Mon, Oct 18, 2010 at 2:07 AM, Dave Page wrote: >> On Sun, Oct 17, 2010 at 2:32 PM, Mike Christensen wrote: >>> Okay my required n00b question of the week, hopefully this'll be an easy >>> one.. >>> >>> I decided to give pgAgent a sho

Re: [GENERAL] Need some help setting up pgAgent

2010-10-18 Thread Mike Christensen
On Mon, Oct 18, 2010 at 2:07 AM, Dave Page wrote: > On Sun, Oct 17, 2010 at 2:32 PM, Mike Christensen wrote: >> Okay my required n00b question of the week, hopefully this'll be an easy >> one.. >> >> I decided to give pgAgent a shot, because there's this stored sproc >> (sorry, function) I need

Re: [GENERAL] Need some help setting up pgAgent

2010-10-18 Thread Dave Page
On Sun, Oct 17, 2010 at 2:32 PM, Mike Christensen wrote: > Okay my required n00b question of the week, hopefully this'll be an easy one.. > > I decided to give pgAgent a shot, because there's this stored sproc > (sorry, function) I need to run nightly and I think spending hours > figuring out pgAg

[GENERAL] Need some help setting up pgAgent

2010-10-17 Thread Mike Christensen
Okay my required n00b question of the week, hopefully this'll be an easy one.. I decided to give pgAgent a shot, because there's this stored sproc (sorry, function) I need to run nightly and I think spending hours figuring out pgAgent would somehow be better than the 3 minutes it would take to add

Re: [GENERAL] Need some help on PG database transfer

2010-07-22 Thread Scott Marlowe
On Thu, Jul 22, 2010 at 2:08 PM, Steeles wrote: > Hi all, > > I am doing some tests on the file level copying for one of database in > windows platform. Here is what I want to achieve. > > copy files within PG tablespace folder where PG database resides to target > machine. I want to attache the c

[GENERAL] Need some help on PG database transfer

2010-07-22 Thread Steeles
Hi all, I am doing some tests on the file level copying for one of database in windows platform. Here is what I want to achieve. copy files within PG tablespace folder where PG database resides to target machine. I want to attache the copied data to target PG database. What I have done is 1. D

Re: [GENERAL] Need some help with a query (uniq -c)

2010-04-13 Thread A B
Thank you all who has replied. I will study your suggestions and see what will work best in my case. 2010/4/13 Kenichiro Tanaka : > Hello. > > I try with "With Query". > http://www.postgresql.org/docs/8.4/static/queries-with.html > > #We can use "With Queries" >  v8.4 > #That'll only work if the t

Re: [GENERAL] Need some help with a query (uniq -c)

2010-04-13 Thread Kenichiro Tanaka
Hello. I try with "With Query". http://www.postgresql.org/docs/8.4/static/queries-with.html #We can use "With Queries" > v8.4 #That'll only work if the time values are contiguous, but there's probably a #similar trick for non-contiguous ,too. --create data drop table foo; create table foo( tim

Re: [GENERAL] Need some help with a query (uniq -c)

2010-04-12 Thread Steve Atkins
On Apr 12, 2010, at 11:31 AM, Scott Marlowe wrote: > On Mon, Apr 12, 2010 at 12:22 PM, A B wrote: >> Hello! >> >> I have a table (think of it as a table of log messages) >> >> time | message >> --- >> 1 | a >> 2 | b >> 3 | b >> 4 | b >> 5 |

Re: [GENERAL] Need some help with a query (uniq -c)

2010-04-12 Thread Sergey Konoplev
On 12 April 2010 22:22, A B wrote: > > first |  message | last | count > -- > 1     |     a              |   1   |     1 > 2     |     b              |   4   |     3     <--- here it squeezes > similar consecutive messages into a single row > 5     |     a      

Re: [GENERAL] Need some help with a query (uniq -c)

2010-04-12 Thread Scott Marlowe
On Mon, Apr 12, 2010 at 12:22 PM, A B wrote: > Hello! > > I have a table (think of it as a table of log messages) > > time |  message > --- > 1      |   a > 2      |   b > 3      |   b > 4      |  b > 5      |  a > > the three 'b' are the same message, so I would like to write

[GENERAL] Need some help with a query (uniq -c)

2010-04-12 Thread A B
Hello! I have a table (think of it as a table of log messages) time | message --- 1 | a 2 | b 3 | b 4 | b 5 | a the three 'b' are the same message, so I would like to write a query that would give me a result that is similar to what the unix

Re: [GENERAL] Need some help converting MS SQL stored proc to postgres function

2009-02-01 Thread Mike Christensen
Thanks! You might be onto something, I see two potential problems though: 1) If the nested select returns no rows (no one has rated the recipe before), it would try to set the value to null. The Rating column is non-nullable which is the way I want it. 2) I'm not exactly 100% sure on this,

Re: [GENERAL] Need some help converting MS SQL stored proc to postgres function

2009-02-01 Thread Tino Wildenhain
Hi, Mike Christensen wrote: Hi guys, I'm in the process of migrating my database from MS SQL 2005 to PostgreSQL and there's one final stored proc that's giving me some problems.. Perhaps someone can give me some help? Here's the sproc: SELECT RecipeId, Avg(Rating) as Rating INTO #ratin

[GENERAL] Need some help converting MS SQL stored proc to postgres function

2009-02-01 Thread Mike Christensen
Hi guys, I'm in the process of migrating my database from MS SQL 2005 to PostgreSQL and there's one final stored proc that's giving me some problems.. Perhaps someone can give me some help? Here's the sproc: SELECT RecipeId, Avg(Rating) as Rating INTO #ratings FROM RecipeRatings GROUP B

Re: [GENERAL] Need some help converting MS SQL stored proc to postgres function

2009-02-01 Thread Ivan Sergio Borgonovo
On Sun, 01 Feb 2009 00:10:52 -0800 Mike Christensen wrote: > Figured out one way to do it, perhaps I can get some feedback on > if this is the best way.. Thanks! > > CREATE TEMP TABLE temp_ratings > ( > RecipeId uuid, > Rating smallint, > CONSTRAINT id_pk PRIMARY KEY (RecipeId) > ); > >

Re: [GENERAL] Need some help converting MS SQL stored proc to postgres function

2009-02-01 Thread Mike Christensen
Figured out one way to do it, perhaps I can get some feedback on if this is the best way.. Thanks! CREATE TEMP TABLE temp_ratings ( RecipeId uuid, Rating smallint, CONSTRAINT id_pk PRIMARY KEY (RecipeId) ); INSERT INTO temp_ratings(RecipeId, Rating) SELECT RecipeId, Avg(Rating) as Rating F

Re: [GENERAL] need some help with pl-pgsql

2008-12-24 Thread Scott Marlowe
On Wed, Dec 24, 2008 at 9:32 AM, justin wrote: > > > Found the problem at last. it was what i thought early this morning, the > database had some flaky data set to null. so modified the the tables in > question set defaults to zero and updated all the records that has null to > zero. hopefully

Re: [GENERAL] need some help with pl-pgsql

2008-12-24 Thread justin
justin wrote: Adrian Klaver wrote: - "justin" wrote: So it appears that something is causing _wipvalue to get set to NULL somewhere else in the code. Now when running the failing select statement manually works is because the modified record is still not committed yet and its

Re: [GENERAL] need some help with pl-pgsql

2008-12-24 Thread Adrian Klaver
On Tuesday 23 December 2008 9:57:01 pm justin wrote: > > I have taken your idea and made sure all the variables all appear the > same and add raise notice for each portion of the command that is failing. > > - > NOTICE: _wipvalue: > CON

Re: [GENERAL] need some help with pl-pgsql

2008-12-23 Thread justin
Adrian Klaver wrote: - "justin" wrote: Adrian Klaver wrote: Would help to see the whole function. Also make sure you did not name one of the variables the same as a column name, this will confuse plpgsql. Are you using the same value for wo_id in the function as in the manual select

Re: [GENERAL] need some help with pl-pgsql

2008-12-23 Thread justin
Adrian Klaver wrote: On Tuesday 23 December 2008 3:36:46 pm Adrian Klaver wrote: Hmmm. A couple of suggestions while I ponder this more. For clarity sake decide on a case scheme. I start getting twitchy when I see pwoid and pWoid refer to the same thing. This depends on case folding being co

Re: [GENERAL] need some help with pl-pgsql

2008-12-23 Thread Adrian Klaver
On Tuesday 23 December 2008 3:36:46 pm Adrian Klaver wrote: > > Hmmm. A couple of suggestions while I ponder this more. For clarity sake > decide on a case scheme. I start getting twitchy when I see pwoid and pWoid > refer to the same thing. This depends on case folding being consistent, not > som

Re: [GENERAL] need some help with pl-pgsql

2008-12-23 Thread Adrian Klaver
- "justin" wrote: > Adrian Klaver wrote: > > Would help to see the > whole function. Also make sure you did not name one of > the variables the same as a column name, this will confuse plpgsql. > Are you > using the same value for wo_id in the function as in the manual select > statement?

Re: [GENERAL] need some help with pl-pgsql

2008-12-23 Thread justin
Adrian Klaver wrote: On Tuesday 23 December 2008 1:04:49 pm justin wrote: have a function written in pgsql it runs just fine, except its doing something really stupid. The function runs just fine till this select statement Select (wo_wipvalue/wo_qtyord) into _TotalCost f

Re: [GENERAL] need some help with pl-pgsql

2008-12-23 Thread Adrian Klaver
On Tuesday 23 December 2008 1:04:49 pm justin wrote: > have a function written in pgsql it runs just fine, except its doing > something really stupid. > > The function runs just fine till this select statement > > Select (wo_wipvalue/wo_qtyord) > into _TotalCost > from wo >

[GENERAL] need some help with pl-pgsql

2008-12-23 Thread justin
have a function written in pgsql it runs just fine, except its doing something really stupid. The function runs just fine till this select statement Select (wo_wipvalue/wo_qtyord) into _TotalCost from wo where wo_id = pWoid ; This goes to the work order header table to

Re: [GENERAL] Need some help

2008-07-01 Thread Chandra ASGI Tech
Probably your installation misses those odbc drivers. you may either use the yum package manager (refer http://www.centos.org/modules/newbb/viewtopic.php?topic_id=12749&forum=44&post_id=42050#forumpost42050) or download the drivers from http://rpm.pbone.net/index.php3/stat/4/idpl/5594193/com/unixOD

Re: [GENERAL] Need some help

2008-07-01 Thread Allan Kamau
Indeed, perhaps no one in the mailing list can look over your shoulder to get the much needed additional details as Chandra has pointed out. My guess is that you may be trying a binary install, perhaps rpm. The install the complains that it cannot find libraries that it requires installed on t

Re: [GENERAL] Need some help

2008-07-01 Thread Andrej Ricnik-Bay
On 01/07/2008, Jamie Deppeler <[EMAIL PROTECTED]> wrote: > trying to install Postgresql 8.3 and i keep getting these errors > > libodbc.so is needed > libodbcinst.so is needed > > Hopefully someone can help me I'll hazard a guess and assume you're using some sort of Linux :} ...which distro are

Re: [GENERAL] Need some help

2008-07-01 Thread Chandra ASGI Tech
Hi, I may not have the answer immediately but I think more details like on which OS you are trying to install and whether you are using the binary or are building it yourself, would be helpful for others to give a solution. Regards, ChandraASGI On Tue, Jul 1, 2008 at 4:37 AM, Jamie Deppeler <[E

[GENERAL] Need some help

2008-07-01 Thread Jamie Deppeler
trying to install Postgresql 8.3 and i keep getting these errors libodbc.so is needed libodbcinst.so is needed Hopefully someone can help me -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-gene

Re: [GENERAL] need some help on figuring out how to write a query

2008-02-23 Thread Jorge Godoy
Em Friday 22 February 2008 13:10:20 Justin escreveu: > I'm not after small code i'm after maintainable code where the date > range for this report would be always changing. So if i can get it to > one select statement i would on have to pass in some variables and it > would create the moving avera

Re: [GENERAL] need some help on figuring out how to write a query

2008-02-22 Thread Justin
I'm not after small code i'm after maintainable code where the date range for this report would be always changing. So if i can get it to one select statement i would on have to pass in some variables and it would create the moving average. Plus what if the sales people decide they want to ch

Re: [GENERAL] need some help on figuring out how to write a query

2008-02-22 Thread Jorge Godoy
Em Thursday 21 February 2008 18:37:47 Justin escreveu: > Now i could write a function to do this or do it in C++ program that > creates query with all kinds of unions. I'm wondering if there is a way > to create this in a single select statement?? > I can't think of a way to do it??? Why you nee

Re: [GENERAL] need some help on figuring out how to write a query

2008-02-21 Thread Scott Marlowe
On Thu, Feb 21, 2008 at 8:09 PM, Dean Gibson (DB Administrator) > Mail to my list address MUST be sent via the mailing list. > All other mail to my list address will bounce. Totally uncool. There's settings in the mail server software that will change your outgoing messages to not be from you

Re: [GENERAL] need some help on figuring out how to write a query

2008-02-21 Thread Dean Gibson (DB Administrator)
On 2008-02-21 13:37, Justin wrote: ... I'm wondering if there is a way to create this in a single select statement?? I can't think of a way to do it??? Break down your problem using VIEWs. Create a VIEW that gets just ONE of the averages, based on a starting date. Then create a SELECT that

[GENERAL] need some help on figuring out how to write a query

2008-02-21 Thread Justin
need to write a query for sales order table where we get the qty order * price for all line items by week then average then create a moving Average past 10 weeks of entered sales orders line items. So what will happen is some one will enter a date range going back 6 month from the present dat

Re: [GENERAL] Need some help creating a database sandbox...

2005-08-03 Thread Magnus Hagander
> I'm trying to setup a "safe" testing database environment for > some unit testing of a web application. I would like to have > the unit tests restore the database to a known state before > every test. The simplest way I thought would be to have the > testing tools drop/create the testing da

Re: [GENERAL] Need some help creating a database sandbox...

2005-08-02 Thread Eric D. Nielsen
On Aug 2, 2005, at 11:33 PM, Tom Lane wrote: "Eric D. Nielsen" <[EMAIL PROTECTED]> writes: ... simplest way I thought would be to have the testing tools drop/ create the testing database on every test case, and then populate the database from a specified file. However I don't want to give th

Re: [GENERAL] Need some help creating a database sandbox...

2005-08-02 Thread Tom Lane
"Eric D. Nielsen" <[EMAIL PROTECTED]> writes: > ... simplest way I thought would be to have the testing tools drop/create > the testing database on every test case, and then populate the > database from a specified file. However I don't want to give the > test user superuser privileges. Thu

[GENERAL] Need some help creating a database sandbox...

2005-08-02 Thread Eric D. Nielsen
I'm trying to setup a "safe" testing database environment for some unit testing of a web application. I would like to have the unit tests restore the database to a known state before every test. The simplest way I thought would be to have the testing tools drop/create the testing database

[GENERAL] need some help with a SELECT

2001-05-21 Thread Tony Grant
Monday... I can't get my brain around this one. Get the top three replies from a quizz. I want to select from a table all records which have a value of 1.00, 2.00 and 3.00. Then I want to class the records by the column which has the most 1 followed by the most 2... Yes I was throw