Re: [GENERAL] Fwd: PSQL Help from your biggest fan

2012-08-17 Thread Raghavendra
> > > I tried your code in Postgres 8.2: > 8.2 ?, Seems you have tested it in very Old version. > CREATE OR REPLACE FUNCTION _final_mode(anyarray) > > RETURNS anyelement AS > > $BODY$ > > SELECT a > > FROM unnest($1) a > > GROUP BY 1 > > ORDER BY COUNT(1) DESC, 1 > > LIMIT 1; > > $BODY$ > > LAN

[GENERAL] Fwd: PSQL Help from your biggest fan

2012-08-17 Thread Evan Stanford
Hi Grzegorz and Pgsql-General, Can you forward this to Scott Bailey? I tried sending it to his old email, but it seems to be closed. Or could you answer my question yourself? Thank you so much, Evan Stanford -- Forwarded message -- From: Evan Stanford Date: Fri, Aug 17, 2012 at 3

Re: [GENERAL] Views versus user-defined functions: formatting, comments, performance, etc.

2012-08-17 Thread Chris Travers
On Fri, Aug 17, 2012 at 2:35 PM, Adam Mackler wrote: > Hi: > > I notice when I save a view, I lose all the formatting and comments. > As I was writing a complicated view, wanting to retain the format and > comments, I thought I could just save it as a function that returns a > table value. A fun

Re: [GENERAL] Views versus user-defined functions: formatting, comments, performance, etc.

2012-08-17 Thread Tom Lane
"David Johnston" writes: > Trying to answer the previous question this one presented itself: I just > tried a couple of very simple queries and couldn't get them give me a plan > that wasn't a "Function Scan". Is it possible that only "scalar" functions > can be inlined? > CREATE OR REPLACE FUN

Re: [GENERAL] Views versus user-defined functions: formatting, comments, performance, etc.

2012-08-17 Thread David Johnston
Included below: 1) Question regarding the ability to inline set-returning functions 2) A comment that not keeping the content between the "CREATE VIEW ... AS" and the trailing ";|EOF" is losing good information to have inside the database. > Correct. The reparse time per se is generally not a b

Re: [GENERAL] Views versus user-defined functions: formatting, comments, performance, etc.

2012-08-17 Thread Uwe Schroeder
> Hi: > > I notice when I save a view, I lose all the formatting and comments. > As I was writing a complicated view, wanting to retain the format and > comments, I thought I could just save it as a function that returns a > table value. A function would evaluate to the same value as a view, >

Re: [GENERAL] Views versus user-defined functions: formatting, comments, performance, etc.

2012-08-17 Thread Merlin Moncure
On Fri, Aug 17, 2012 at 5:44 PM, Tom Lane wrote: > Adam Mackler writes: >> I notice when I save a view, I lose all the formatting and comments. >> As I was writing a complicated view, wanting to retain the format and >> comments, I thought I could just save it as a function that returns a >> tabl

Re: [GENERAL] Views versus user-defined functions: formatting, comments, performance, etc.

2012-08-17 Thread Tom Lane
Adam Mackler writes: > I notice when I save a view, I lose all the formatting and comments. > As I was writing a complicated view, wanting to retain the format and > comments, I thought I could just save it as a function that returns a > table value. A function would evaluate to the same value as

[GENERAL] Views versus user-defined functions: formatting, comments, performance, etc.

2012-08-17 Thread Adam Mackler
Hi: I notice when I save a view, I lose all the formatting and comments. As I was writing a complicated view, wanting to retain the format and comments, I thought I could just save it as a function that returns a table value. A function would evaluate to the same value as a view, but changing it

Re: Messy data models (Re: [GENERAL] Visualize database schema)

2012-08-17 Thread Sébastien Lorion
Short answer: no. Even with a good auto-layout, nothing (up to now) beats a human made one because the latter will incorporate semantic which is not available to the modeling tool; for example, positioning, spacing and routing of relations will respect some sense of aesthetic and organization that

Re: Messy data models (Re: [GENERAL] Visualize database schema)

2012-08-17 Thread David Johnston
> -Original Message- > From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general- > ow...@postgresql.org] On Behalf Of Wolfgang Keller > Sent: Friday, August 17, 2012 9:08 AM > To: pgsql-general@postgresql.org > Subject: Messy data models (Re: [GENERAL] Visualize database schema) > >

[GENERAL] Replication with infrequent large updates

2012-08-17 Thread Matthew Vernon
Hi, I have a couple of queries about replication. Essentially, I have three servers reasonably remote from each other. The master server gets large (order 1-10GB) updates very infrequently (every month or so), which usually go into new schema. The two slaves need to provide read-only access to the

Re: [GENERAL] Best practice non privilege postgres-user

2012-08-17 Thread Albe Laurenz
Frank Lanitz wrote: > I'm looking for some kind of best practice for a non-privilege postgres > user. As not all operations can be done within psql you might need > access to postgres- on command line from time to time. Currently this is > done via root-privvileges and >su - postgres< directly on d

Messy data models (Re: [GENERAL] Visualize database schema)

2012-08-17 Thread Wolfgang Keller
> Concerning auto-layout, most if not all tools I have used up to now > make a mess for anything that is not dead simple. If a data model can not be reasonably "untangled" by an auto-layout algorithm (such as e.g. Graphviz) for display as a human-readable graph, wouldn't that mean that this model

Re: [GENERAL] Best practice non privilege postgres-user

2012-08-17 Thread Moshe Jacobson
I do not know of anything that can't be done from within psql. We use non-privileged user roles in postgres for day-to-day operations. When I need to modify the schema, I become postgres (you can do \c - postgres) and do what I need to do, then revert back to my regular user. On Fri, Aug 17, 2012

Re: [GENERAL] Check PostgreSQL status using MS-DOS bat file?

2012-08-17 Thread dinesh kumar
Hi , Dave's instructions are helpful for finding the status of the server.. However, I do have the below the script which is nothing but PgPing in windows ... I hope it helps you in the implementation .. @ECHO OFF set PSQL="C:\Program Files\PostgreSQL\9.1\bin" set DBNAME="template1" set USER=

Re: [GENERAL] Check PostgreSQL status using MS-DOS bat file?

2012-08-17 Thread Dave Page
[Please keep the mailing list CC'd] On Fri, Aug 17, 2012 at 11:52 AM, Loughrey, Hugh wrote: > Hi Dave, > > Thanks for the message below. The script you forwarded looks to be for an > instance in which the DB is running of a windows box, apologies I should have > mentioned, we currently run Post

[GENERAL] Best practice non privilege postgres-user

2012-08-17 Thread Frank Lanitz
Hi folks, I'm looking for some kind of best practice for a non-privilege postgres user. As not all operations can be done within psql you might need access to postgres- on command line from time to time. Currently this is done via root-privvileges and »su - postgres« directly on database server -

Re: [GENERAL] How to analyze load average ?

2012-08-17 Thread Condor
On , Tomas Vondra wrote: I think load avg is high because before I change the servers my produce server was on 16 cpu, 24 gb memory and load avg on that server was 0.24. Database is the same, users that use the server is the same, nothing is changed. I dump the DB from old server and import it