Re: [GENERAL] tx canceled on standby despite infinite max_standby_streaming_delay

2016-05-14 Thread Venkata Balaji N
On Sat, May 14, 2016 at 12:27 PM, Jay Howard wrote: > I'm seeing long-running transactions (pg_dump) canceled on the standby > when there are a lot of inserts happening on the master. This despite my > having set max_standby_streaming_delay to -1 on the standby. > Do you have hot_standby_feedba

Re: [GENERAL] How to use row values as function parameters

2016-05-14 Thread David G. Johnston
On Sat, May 14, 2016 at 5:34 PM, Adrian Klaver wrote: > On 05/14/2016 02:13 PM, Andrus wrote: > >> Hi! >> >> Thank you. >> >> >>> Use a CTE and move the function call to the select list - then explode >> the result in the main query. >> >>> Basically: >>> WITH func_cte AS ( >>> SELECT func_call(t

Re: [GENERAL] How to use row values as function parameters

2016-05-14 Thread Adrian Klaver
On 05/14/2016 02:13 PM, Andrus wrote: Hi! Thank you. Use a CTE and move the function call to the select list - then explode the result in the main query. Basically: WITH func_cte AS ( SELECT func_call(tbl) FROM tbl )​ ​>SELECT (func_call).* FROM func_cte; ​>​The parens are required to m

Re: [GENERAL] How to use row values as function parameters

2016-05-14 Thread Andrus
Hi! Thank you. >Use a CTE and move the function call to the select list - then explode the >result in the main query. >Basically: >WITH func_cte AS ( >SELECT func_call(tbl) FROM tbl )​ ​>SELECT (func_call).* >FROM func_cte; ​>​The parens are required to make the parser see func_call as a column n

Re: [GENERAL] How to use row values as function parameters

2016-05-14 Thread Adrian Klaver
On 05/14/2016 01:47 PM, Andrus wrote: Table ko should used to pass parameters to crtKAIVE() function. ko has always single row. I tried CREATE or replace FUNCTION public.crtKAIVE( _doktyybid text default 'GVY' ) RETURNS TABLE ( id integer ) AS $f_crkaive$ select 1 $f_crkaive$ LANGUAGE sql STABL

Re: [GENERAL] How to use row values as function parameters

2016-05-14 Thread David G. Johnston
On Sat, May 14, 2016 at 4:47 PM, Andrus wrote: > Table ko should used to pass parameters to crtKAIVE() function. > ko has always single row. > > I tried > > CREATE or replace FUNCTION public.crtKAIVE( > _doktyybid text default 'GVY' > ) > RETURNS TABLE ( > id integer > ) > AS $f_crkaive$ > select

[GENERAL] How to use row values as function parameters

2016-05-14 Thread Andrus
Table ko should used to pass parameters to crtKAIVE() function. ko has always single row. I tried CREATE or replace FUNCTION public.crtKAIVE( _doktyybid text default 'GVY' ) RETURNS TABLE ( id integer ) AS $f_crkaive$ select 1 $f_crkaive$ LANGUAGE sql STABLE; create temp table ko ( doktyyp tex

[GENERAL] PG wire protocol question

2016-05-14 Thread Boszormenyi Zoltan
Hi, it was a long time I have read this list or written to it. Now, I have a question. This blog post was written about 3 years ago: https://aphyr.com/posts/282-jepsen-postgres Basically, it talks about the client AND the server as a system and if the network is cut between sending COMMIT and r

Re: [GENERAL] Foreign key triggers

2016-05-14 Thread Adam Brusselback
Yes, foreign keys are implemented using triggers. Here is a blog post explaining a little more: http://bonesmoses.org/2014/05/14/foreign-keys-are-not-free/ I would assume it's still got to do a seq scan even on every referencing table even if it's empty for every record since there are no indexes.

Re: [GENERAL] index on ILIKE/LIKE - PostgreSQL 9.2

2016-05-14 Thread Jeff Janes
On Thu, May 12, 2016 at 2:32 PM, Lucas Possamai wrote: >> -> Bitmap Index Scan on "ix_jobs_trgm_gin" >> (cost=0.00..335.64 rows=485 width=0) (actual time=3883.886..3883.886 rows=32 >> loops=1) >> Index Cond: (("title")::"text" ~~* '%RYAN >> WER%'::"t

Re: [GENERAL] Update or Delete causes canceling of long running slave queries

2016-05-14 Thread Jeff Janes
On Thu, May 12, 2016 at 9:22 PM, Viswanath wrote: > Hi, > Thank you for the explanation. > The slave queries are mostly reporting queries,which sometimes would take > 30+ running time due to complex joins and criteria. We haven't tried running > these queries on master before splitting, and it is

Re: [SPAM] [GENERAL] COPY command & binary format

2016-05-14 Thread Nicolas Paris
Well the job is done. The talend component is working ( https://github.com/parisni/talend/tree/master/tPostgresqlOutputBulkAPHP). It allows creating a file (binary or csv) locally, and then use the COPY function with "FROM STDIN" that does not need to push the file on a remote database server. I h

Re: [GENERAL] Keeping top N records of a group

2016-05-14 Thread Andreas Kretschmer
Alex Magnum wrote: > Hi, > i want to archive data and am looking for a query to replace a rather slow > function i am currently using. > > The idea is that for every sym and doc_key I want to keep the records of the > top 2 sources. Eg. in below table I want to archive  sounds like a case for w

[GENERAL] Keeping top N records of a group

2016-05-14 Thread Alex Magnum
Hi, i want to archive data and am looking for a query to replace a rather slow function i am currently using. The idea is that for every sym and doc_key I want to keep the records of the top 2 sources. Eg. in below table I want to archive sym 1022 of source 3000 but keep the 4 records from sources

Re: [GENERAL] Using both ident and password in pg_hba.conf

2016-05-14 Thread Peter J. Holzer
On 2016-05-09 16:18:39 -0400, D'Arcy J.M. Cain wrote: > On Mon, 9 May 2016 13:02:53 -0700 > Adrian Klaver wrote: > > So define PHP runs as 'nobody'? > > Because of the way PHP and Apache works PHP script have to run as the > Apache user which, in my case anyway, is "nobody" so every PHP script >

Re: [GENERAL] Streaming replication, master recycling

2016-05-14 Thread Venkata Balaji N
On Wed, May 11, 2016 at 9:04 PM, wrote: > I apologise for the missing data. > > we are running 9.1.15 on debian servers. > There is a possibility of making the old master standby if you have promoted standby after clean-shutting down the master. I I tested this in 9.2.x and later versions. This