Re: [GENERAL] Understanding EXPLAIN

2012-02-03 Thread Tom Lane
Robert Lichtenberger writes: > I am trying to fully understand, how costs for queries are computed. > Taking the following example: ... > Index Scan using test_pkey on test (cost=0.00..8.27 rows=1 width=3) >Index Cond: ((name)::text = '4'::text) > The value I want to understand is 8.27. Fro

Re: [GENERAL] Understanding EXPLAIN

2012-02-03 Thread Andreas Kretschmer
Robert Lichtenberger wrote: > I am trying to fully understand, how costs for queries are computed. > Taking the following example: > > CREATE TABLE test (name varchar(250) primary key) ; > INSERT INTO test (name) VALUES(generate_series(1, 1000)::text) ; > ANALYZE test ; > EXPLAIN SELECT * FROM

[GENERAL] last entry per person

2012-02-03 Thread garry
I have a table which holds a user name and their results in exams. There can be multiple entries per user. I am trying to return the last entry for each user. I can get the last entry in the table using the order by/limit method but how would this be applied per user. My table definition is lik

Re: [GENERAL] last entry per person

2012-02-03 Thread Chris Travers
On Fri, Feb 3, 2012 at 12:26 AM, garry wrote: > I have a table which holds a user name and their results in exams. There > can be multiple entries per user. I am trying to return the last entry for > each user. I can get the last entry in the table using the order by/limit > method but how would

Re: [GENERAL] last entry per person

2012-02-03 Thread Andreas Kretschmer
garry wrote: > I have a table which holds a user name and their results in exams. There > can be multiple entries per user. I am trying to return the last entry > for each user. I can get the last entry in the table using the order > by/limit method but how would this be applied per user. M

Re: [GENERAL] last entry per person

2012-02-03 Thread Philip Couling
On 03/02/2012 08:30, Chris Travers wrote: On Fri, Feb 3, 2012 at 12:26 AM, garry > wrote: I have a table which holds a user name and their results in exams. There can be multiple entries per user. I am trying to return the last entry for each user. I

Re: [GENERAL] last entry per person

2012-02-03 Thread garry
On 03/02/2012 08:30, Chris Travers wrote: On Fri, Feb 3, 2012 at 12:26 AM, garry > wrote: I have a table which holds a user name and their results in exams. There can be multiple entries per user. I am trying to return the last entry for each user. I

[GENERAL] What is the best way to force character data to upper case

2012-02-03 Thread Dennis
I am wondering what the best way is to force character data to a specific case, like upper case for example. Is a trigger or rule the only option? Would a check constraint be better or faster than using rules or triggers, knowing that a check constraint puts the onus back on the client code to en

Re: [GENERAL] What is the best way to force character data to upper case

2012-02-03 Thread Chris Travers
On Wed, Feb 1, 2012 at 10:09 PM, Dennis wrote: > I am wondering what the best way is to force character data to a specific > case, like upper case for example. Is a trigger or rule the only option? > Would a check constraint be better or faster than using rules or triggers, > knowing that a che

Re: [GENERAL] What is the best way to force character data to upper case

2012-02-03 Thread Raymond O'Donnell
On 02/02/2012 06:09, Dennis wrote: > I am wondering what the best way is to force character data to a > specific case, like upper case for example. Is a trigger or rule the > only option? Would a check constraint be better or faster than using > rules or triggers, knowing that a check constraint

Re: [GENERAL] Extensions btree_gist and cube collide?

2012-02-03 Thread Jay Levitt
Tom Lane wrote: =?ISO-8859-2?Q?pasman_pasma=F1ski?= writes: When i add extensions: cube and btree_gist. First extension installs, but second not. There is a (spelled) error message: ERROR: operator 6(oid,oid) already exists in operator's family gist_oid_ops Hmm, works for me: FWIW, I saw

Re: [GENERAL] [GENERA]: Postgresql-9.1.1 synchronous replication issue

2012-02-03 Thread Adrian Klaver
On Thursday, February 02, 2012 10:21:28 pm Venkat Balaji wrote: > > Connection is working fine between primary and standby, ping is working > fine and wal archive file transfer is working without any issues. > > I tried CREATE TABLE and CREATE DATABASE, both were hanging. > > Apart from regular

[GENERAL] multiple parameters to an AGGREGATE function

2012-02-03 Thread Graham
Hi, first time poster here ... I'm trying to write a simple Aggregate function which returns the nth element in a collection - ultimately I want to find 95th, 90th percentiles and so on. It'd be called like: select nth_element( value, 95 ) from something group by ... I'm basing this on an e

Re: [GENERAL] multiple parameters to an AGGREGATE function

2012-02-03 Thread Merlin Moncure
On Fri, Feb 3, 2012 at 11:27 AM, Graham wrote: > Hi, >   first time poster here ... > > I'm trying to write a simple Aggregate function which returns the nth > element in a collection - ultimately I want to find 95th, 90th percentiles > and so on. > > It'd be called like: > > select nth_element( v

Re: [GENERAL] restart server on Lion

2012-02-03 Thread John R Pierce
On 02/01/12 4:55 PM, Scott Frankel wrote: I run PostgreSQL in a closed environment, for development and testing purposes, on my laptop. Installing a *-server package seemed overkill. Quite the contrary, that's exactly what I should've done from the beginning. fwiw, on many linux systems, th

Re: [GENERAL] Puzzling full database lock

2012-02-03 Thread Christopher Opena
Merlin, thanks for the response. My comments below, but firstly, does anyone know if autovacuum is affected by setting a statement_timeout? There was a long thread here from 2007'ish: http://thread.gmane.org/gmane.comp.db.postgresql.devel.general/80044/focus=93847 But it's unclear to me which w

[GENERAL] Warning: you don't own a lock of type ExclusiveLock

2012-02-03 Thread Gary Chambers
All, I have a recently-migrated Pg cluster running 8.4.7 on Red Hat Enterprise Linux Client release 5.7 (Tikanga) in a VMware VM that is logging the subject warning. The application code is considerably old (deployed back in the 7.4 days, I believe) and the message is preceded by a call to selec

Re: [GENERAL] Warning: you don't own a lock of type ExclusiveLock

2012-02-03 Thread Chris Angelico
On Sat, Feb 4, 2012 at 8:27 AM, Gary Chambers wrote: > All, > > I have a recently-migrated Pg cluster running 8.4.7 on Red Hat Enterprise > Linux Client release 5.7 (Tikanga) in a VMware VM that is logging the > subject warning.  The application code is considerably old (deployed back in > the 7.4

Re: [GENERAL] Puzzling full database lock

2012-02-03 Thread Tom Lane
Christopher Opena writes: > Merlin, thanks for the response. My comments below, but firstly, does > anyone know if autovacuum is affected by setting a statement_timeout? It is not; in all recent PG releases, the autovacuum processes are careful to force a session setting of zero.

[GENERAL] debugging the server[ module causes server cash]

2012-02-03 Thread Dave Potts
Hi I have just inherited a private C module that lives in the context of the server with little or no documentation. It crashes taking the database down, is there any advice on how to debug this type of beast ? This is not a problem with the postgres server but user module. -- Sent via pgsql

Re: [GENERAL] debugging the server[ module causes server cash]

2012-02-03 Thread John R Pierce
On 02/03/12 11:37 PM, Dave Potts wrote: Hi I have just inherited a private C module that lives in the context of the server with little or no documentation. It crashes taking the database down, is there any advice on how to debug this type of beast ? This is not a problem with the postgres se