Re: [GENERAL] Will pg_repack improve this query performance?

2014-10-16 Thread Abelard Hoffman
On Wed, Oct 15, 2014 at 2:03 AM, Alban Hertroys wrote: > > On 15 Oct 2014, at 4:33, Abelard Hoffman wrote: > > > I believe this query is well optimized, but it's slow if the all the > blocks aren't already in memory. > > > > Here's example explain o

[GENERAL] Will pg_repack improve this query performance?

2014-10-14 Thread Abelard Hoffman
I believe this query is well optimized, but it's slow if the all the blocks aren't already in memory. Here's example explain output. You can see it takes over 7 seconds to run when it needs to hit the disk, and almost all of it is related to checking if the user has "messages." http://explain.d

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

2014-09-29 Thread Abelard Hoffman
the database and commit their changes to the production state. > As I've got a unique history ID for each table and each row, I should be > able to map the affected records. > > Have a look and tell me what you think of it. > > Cheers > Felix > > > Gesendet:

[GENERAL] table versioning approach (not auditing)

2014-09-28 Thread Abelard Hoffman
Hi. I need to maintain a record of all changes to certain tables so assist in viewing history and reverting changes when necessary (customer service makes an incorrect edit, etc.). I have studied these two audit trigger examples: https://wiki.postgresql.org/wiki/Audit_trigger https://wiki.postgres

Re: [GENERAL] Installing Postgresql on Linux Friendlyarm

2014-09-22 Thread Abelard Hoffman
On Mon, Sep 22, 2014 at 7:39 PM, Tom Lane wrote: > Xiang Gan writes: > > OK. So a stupid question, whether there is any possibility to run > Postgresql as root? (I know this is forbidden generally. But what I find > out is that in Linux FriendlyArm environment, root could create socket > while n

Re: [GENERAL] pg_dump does not include database-level user-defined GUC variables?

2014-09-16 Thread Abelard Hoffman
On Tue, Sep 16, 2014 at 12:39 PM, Adrian Klaver wrote: > On 09/16/2014 10:33 AM, Michael Paquier wrote: > >> On Tue, Sep 16, 2014 at 8:43 AM, Pavel Stehule >> wrote: >> >>> 2014-09-16 17:39 GMT+02:00 Kevin Grittner : >>> >>>> Abelard Hoffman

[GENERAL] pg_dump does not include database-level user-defined GUC variables?

2014-09-16 Thread Abelard Hoffman
I have a user-defined GUC variable that was set at the db level. e.g., ALTER DATABASE mydb SET myapp.user_id TO '1' Works fine. When I do a pg_dump, however, that variable isn't included. Is that expected? It's not really an attribute of the database? Thanks.

Re: [GENERAL] Testing truthiness of GUC variables?

2014-09-15 Thread Abelard Hoffman
On Mon, Sep 15, 2014 at 5:39 AM, Kevin Grittner wrote: > Abelard Hoffman wrote: > > >> Boolean values can be written as on, off, true, false, yes, no, > >> 1, 0 (all case-insensitive) or any unambiguous prefix of these. > > > > is there a built-in funct

Re: [GENERAL] Testing truthiness of GUC variables?

2014-09-14 Thread Abelard Hoffman
On Sun, Sep 14, 2014 at 11:17 PM, Abelard Hoffman wrote: > If I set a custom GUC variable to a boolean value, such as: > > SET myapp.audit = 'on'; > > is there a way to test it for truthiness in the same way the standard > built-in variables are? IOW, the docs say

[GENERAL] Testing truthiness of GUC variables?

2014-09-14 Thread Abelard Hoffman
If I set a custom GUC variable to a boolean value, such as: SET myapp.audit = 'on'; is there a way to test it for truthiness in the same way the standard built-in variables are? IOW, the docs say a boolean can be written as: Boolean values can be written as on, off, true, false, yes, no, 1, 0

Re: [GENERAL] psql and tab-delimited output

2014-09-08 Thread Abelard Hoffman
On Sun, Sep 7, 2014 at 5:17 PM, Melvin Davidson wrote: > >the output I'd prefer is: > > id fld_1 > > 1 test\tvalue > > 2 test\tvalue > > 3 >test\tvalue > > > > > > *Does this work for you?copy (SELECT id, replace(fld_1, '', '\t') FROM > tsv_test) to stdout with csv header delimiter '';*

Re: [GENERAL] psql and tab-delimited output

2014-09-08 Thread Abelard Hoffman
Hi Alban. On Sun, Sep 7, 2014 at 4:18 AM, Alban Hertroys wrote: > On 07 Sep 2014, at 10:45, Abelard Hoffman > wrote: > > > For reports, everyone else mostly uses other tools? I'd like to stay > away from GUI-tools, if possible. > > For reporting, usually you

Re: [GENERAL] psql and tab-delimited output

2014-09-08 Thread Abelard Hoffman
On Sun, Sep 7, 2014 at 12:28 PM, Jeff Janes wrote: > On Sat, Sep 6, 2014 at 12:32 AM, Abelard Hoffman > wrote: > [snip] > I know that COPY() will escape tabs (as \t), and we can use that from psql >> with the \copy command, but that does not include a header row of t

Re: [GENERAL] psql and tab-delimited output

2014-09-07 Thread Abelard Hoffman
On Sat, Sep 6, 2014 at 11:43 AM, Adrian Klaver wrote: > On 09/06/2014 10:34 AM, Abelard Hoffman wrote: > >> On Sat, Sep 6, 2014 at 7:28 AM, Adrian Klaver > <mailto:adrian.kla...@aklaver.com>> wrote: >> >> On 09/06/2014 12:32 AM, Abelard Hoffman wrot

Re: [GENERAL] psql and tab-delimited output

2014-09-06 Thread Abelard Hoffman
On Sat, Sep 6, 2014 at 7:28 AM, Adrian Klaver wrote: > On 09/06/2014 12:32 AM, Abelard Hoffman wrote: [snip] > So, my question is, what's the simplest way to generate tab-escaped >> TSV-formatted reports with the first line containing the list of column >> names?

[GENERAL] psql and tab-delimited output

2014-09-06 Thread Abelard Hoffman
Hi. Traditionally, to generate a TSV report, I've simply invoked psql with: --no-align --field-separator '\t' --pset footer=off That works in most cases, except when your column values contain tabs themselves. I know that COPY() will escape tabs (as \t), and we can use that from psql with the \c