Re: [GENERAL] Extract especific text from a sql statement

2014-10-01 Thread David G Johnston
Melvin Davidson-5 wrote > You already have most of the result columns, so the following should do > it. > > SELECT pc.cod, > pc.val, > pi.qtd, > COALESCE(pc.name, 'empty') AS name, > lower(coalesce(pc.email, 'empty')) as email, > status, > c1.relnam

Re: [GENERAL] Extract especific text from a sql statement

2014-10-01 Thread Melvin Davidson
You already have most of the result columns, so the following should do it. SELECT pc.cod, pc.val, pi.qtd, COALESCE(pc.name, 'empty') AS name, lower(coalesce(pc.email, 'empty')) as email, status, c1.relname, c2.relname, pc.startdate

Re: [GENERAL] Is there a way to get both the plan and the results?

2014-10-01 Thread David G Johnston
François Beausoleil wrote > Hi all! > > Building a small tool, and it would be super useful if I could get both > the query results and the plan at the same time. At the moment, the tool > accepts a SQL query, drops it into a file and call psql > --file=whatever.sql. I can change to use a lower-

[GENERAL] Is there a way to get both the plan and the results?

2014-10-01 Thread François Beausoleil
Hi all! Building a small tool, and it would be super useful if I could get both the query results and the plan at the same time. At the moment, the tool accepts a SQL query, drops it into a file and call psql --file=whatever.sql. I can change to use a lower-level API if necessary. Ideally, I’d

Re: [GENERAL] improving speed of query that uses a multi-column "filter" ?

2014-10-01 Thread Jonathan Vanasco
On Oct 1, 2014, at 12:34 AM, Misa Simic wrote: > Have you considered maybe partial indexes? > > http://www.postgresql.org/docs/9.3/static/indexes-partial.html > > I.e idx1 on pk column of the table with where inside index exactly the same > as your first where > > Idx2 on pk column with where

Re: [GENERAL] Extract especific text from a sql statement

2014-10-01 Thread David G Johnston
Emanuel Araújo wrote > Hi, > > I need help to extract fields and tables from a sql statement. > > Example: > > SELECT pc.cod, pc.val, pi.qtd, > COALESCE(pc.name, 'empty') AS name, lower(coalesce(pc.email, 'empty')) as > email, > status > FROM pc > INNER JOIN pi on (pc.cod = pi.cod) > WHERE pc.st

Re: [GENERAL] table versioning approach (not auditing)

2014-10-01 Thread Adam Brusselback
I know we're kinda hijacking this thread, so sorry for that. If you'd like to do that, i'd be more than happy to use it and push any fixes / changes upstream. I don't have much of a preference on the name either, as long as it's something that makes sense. I would consider myself far from an exp

Re: [GENERAL] Postgres tcp_keepalive_xxxx parameters.

2014-10-01 Thread Tom Lane
jlrando writes: > We have an issue with postgres clients tha are being disconnected from > database server after some time. Client is a web application which creates a > pool of connections. Since client and server are on different VLANS I think > the problem is that the FW which is routing traffi

Re: [GENERAL] Best practices for Large import in empty database?

2014-10-01 Thread Daniel Begin
Oups, right to the point! Thanks... -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Tom Lane Sent: October-01-14 10:38 To: Daniel Begin Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Best practices for Large impo

[GENERAL] Postgres tcp_keepalive_xxxx parameters.

2014-10-01 Thread jlrando
Hi. We have an issue with postgres clients tha are being disconnected from database server after some time. Client is a web application which creates a pool of connections. Since client and server are on different VLANS I think the problem is that the FW which is routing traffic is droping idle co

Re: [GENERAL] Best practices for Large import in empty database?

2014-10-01 Thread Andy Colson
On 10/1/2014 9:13 AM, Daniel Begin wrote: I am about to feed an empty database with a large import of data (the size of csv files is about 500 GB). Tables are created but I haven't added any constraints or indexes yet. I wonder whether the best practice is to add them before or after the import.

Re: [GENERAL] Best practices for Large import in empty database?

2014-10-01 Thread Tom Lane
Daniel Begin writes: > I am about to feed an empty database with a large import of data (the size > of csv files is about 500 GB). Tables are created but I haven't added any > constraints or indexes yet. I wonder whether the best practice is to add > them before or after the import. Are there othe

[GENERAL] Best practices for Large import in empty database?

2014-10-01 Thread Daniel Begin
I am about to feed an empty database with a large import of data (the size of csv files is about 500 GB). Tables are created but I haven't added any constraints or indexes yet. I wonder whether the best practice is to add them before or after the import. Are there other good practices that would ea

[GENERAL] Extract especific text from a sql statement

2014-10-01 Thread Emanuel Araújo
Hi, I need help to extract fields and tables from a sql statement. Example: SELECT pc.cod, pc.val, pi.qtd, COALESCE(pc.name, 'empty') AS name, lower(coalesce(pc.email, 'empty')) as email, status FROM pc INNER JOIN pi on (pc.cod = pi.cod) WHERE pc.startdate > CURRENT_DATE order by 1 desc ; I nee

Re: [GENERAL] table versioning approach (not auditing)

2014-10-01 Thread Felix Kunde
Hey there. Thank you very much for that fix! Thats why I'd like to have a joint development and joint testing. It's way more convincing for users to go for a solution that is tested by some experts than just by a random developer :) I'm open to create a new project and push the code there. Don'