[GENERAL] Slow Query problem

2008-01-27 Thread Premsun Choltanwanich
Dear All, I am currently using PostgreSQL database version 8.0.13.  My problem relates to a slow result when a query using a defined view joins to another table for a result. Background:  I have 7 tables of invoice transactions.  The tables are slightly different in that they record different dat

Re: [GENERAL] what is it that \d actually does

2008-01-27 Thread Merlin Moncure
On Jan 25, 2008 2:41 PM, Scott Marlowe <[EMAIL PROTECTED]> wrote: > On Jan 25, 2008 1:34 PM, Geoffrey <[EMAIL PROTECTED]> wrote: > > It seems that I recall there is a way to display the actual select > > statement that is executed when you execute the \d command. > > psql --help says: > > -E

Re: [GENERAL] [OT] Slony Triggers pulling down performance?

2008-01-27 Thread Ow Mun Heng
On Fri, 2008-01-18 at 14:57 -0500, Chris Browne wrote: > [EMAIL PROTECTED] (Ow Mun Heng) writes: > > Just wondering if my 'Perceived' feeling that since implementing slony > > for master/slave replication of select tables, my master database > > performance is getting slower. > > > > I'm constantl

Re: [GENERAL] match accented chars with ASCII-normalised version

2008-01-27 Thread Jaime Casanova
On Jan 25, 2008 12:02 AM, brian <[EMAIL PROTECTED]> wrote: > The client for a web application I'm working on wants certain URLs to > contain the full names of members ("SEO-friendly" links). Scripts would > search on, say, a member directory entry based on the name of the > member, rather than the

Re: [GENERAL] Very long execution time of "select nextval('..');"

2008-01-27 Thread Greg Smith
On Sun, 27 Jan 2008, [EMAIL PROTECTED] wrote: ok, at the moment i got some traffic and my load is at 1.5. But now with logging the timestamp I have seen that the long durations are quite regular at intervals of 10 minutes. Sure sounds like checkpoints. You should turn on the checkpoint warnin

Re: [GENERAL] Very long execution time of "select nextval('..');"

2008-01-27 Thread Tom Lane
[EMAIL PROTECTED] writes: > ok, at the moment i got some traffic and my load is at 1.5. But now with > logging the timestamp I have seen that the long durations are quite regular > at intervals of 10 minutes. Well, that's pretty suggestive. Tell us about your checkpoint and bgwriter settings.

Re: [GENERAL] Very long execution time of "select nextval('..');"

2008-01-27 Thread mljv
Am Sonntag 27 Januar 2008 18:56:49 schrieb Tom Lane: > [EMAIL PROTECTED] writes: > > we run postgresql-8.1 on a dedicated debian box 64bit, dual-core CPU, 8GB > > RAM, RAID-1. > > 8.1.what? 8.1.11-0etch1 > > LOG: duration: 12636.746 ms statement: EXECUTE [PREPARE: > > select nextval ('member

Re: [GENERAL] A select DISTINCT query? - followup Q

2008-01-27 Thread Phil Rhoades
Mike, I can't do that with my comments - I get all six of the records in the result with the example instead of just four like I want . . but someone else had a solution without using the "group by" clause . . Phil. On Sun, 2008-01-27 at 13:56 -0500, Mike Ginsburg wrote: > Hi Phil, > Each of

Re: [GENERAL] A select DISTINCT query? - followup Q

2008-01-27 Thread Tom Lane
johnf <[EMAIL PROTECTED]> writes: > On Sunday 27 January 2008 10:56:18 am Mike Ginsburg wrote: >> Each of columns that you specify in your SELECT clause, must also >> appear in the GROPU BY clause. > Is the requirement of select fields matching group by fields a SQL92 > requirement or something t

Re: [GENERAL] A select DISTINCT query? - followup Q

2008-01-27 Thread johnf
On Sunday 27 January 2008 10:56:18 am Mike Ginsburg wrote: > Hi Phil, > Each of columns that you specify in your SELECT clause, must also > appear in the GROPU BY clause. > > SELECT COUNT(*) AS cnt, name, comment, ... > FROM tst > GROUP BY name, comment, ... > HAVING COUNT(*) = 1; > Is the requir

Re: [GENERAL] A select DISTINCT query? - followup Q

2008-01-27 Thread Mike Ginsburg
Hi Phil, Each of columns that you specify in your SELECT clause, must also appear in the GROPU BY clause. SELECT COUNT(*) AS cnt, name, comment, ... FROM tst GROUP BY name, comment, ... HAVING COUNT(*) = 1; Phil Rhoades wrote: People, select count(*) as cnt, name from tst group by nam

Re: [GENERAL] Very long execution time of "select nextval('..');"

2008-01-27 Thread Tom Lane
[EMAIL PROTECTED] writes: > we run postgresql-8.1 on a dedicated debian box 64bit, dual-core CPU, 8GB > RAM, > RAID-1. 8.1.what? > LOG: duration: 12636.746 ms statement: EXECUTE [PREPARE: select > nextval ('member_id_seq')] That's just bizarre, especially if your system isn't showing any

Re: [GENERAL] A select DISTINCT query? - followup Q

2008-01-27 Thread Phil Rhoades
People, > select count(*) as cnt, name from tst group by name having count(*) = 1 This worked for my basic example but not for my actual problem - I get "column comment must appear in the GROUP BY clause or be used in an aggregate function" errors so I have a related question: With table: nam

Re: [GENERAL] A select DISTINCT query?

2008-01-27 Thread Phil Rhoades
Guys, On Sun, 2008-01-27 at 17:38 +0100, Pavel Stehule wrote: > On 27/01/2008, Phil Rhoades <[EMAIL PROTECTED]> wrote: > > Tino, > > > > > > On Sun, 2008-01-27 at 15:16 +0100, Tino Wildenhain wrote: > > > Phil Rhoades wrote: > > > > People, > > > > > > > > I want to select from a table ONLY uniqu

Re: [GENERAL] A select DISTINCT query?

2008-01-27 Thread Pavel Stehule
On 27/01/2008, Phil Rhoades <[EMAIL PROTECTED]> wrote: > Tino, > > > On Sun, 2008-01-27 at 15:16 +0100, Tino Wildenhain wrote: > > Phil Rhoades wrote: > > > People, > > > > > > I want to select from a table ONLY unique records ie if a column has > > > values: > > > > > > 1 > > > 2 > > > 3 > > > 3 >

Re: [GENERAL] A select DISTINCT query?

2008-01-27 Thread hubert depesz lubaczewski
On Mon, Jan 28, 2008 at 03:32:18AM +1100, Phil Rhoades wrote: > SELECT count(*) as cnt, name FRoM tst GROUP BY name HAVING cnt = 1 ; > ERROR: column "cnt" does not exist > LINE 1: ...ount(*) as cnt, name FRoM tst GROUP BY name HAVING cnt = 1 ; having count(*) = 1; depesz -- quicksil1er: "postg

Re: [GENERAL] A select DISTINCT query?

2008-01-27 Thread Phil Rhoades
Tino, On Sun, 2008-01-27 at 15:16 +0100, Tino Wildenhain wrote: > Phil Rhoades wrote: > > People, > > > > I want to select from a table ONLY unique records ie if a column has > > values: > > > > 1 > > 2 > > 3 > > 3 > > 4 > > 5 > > > > I want ONLY these records returned: > > > > 1 > > 2 > > 4

Re: [GENERAL] A select DISTINCT query?

2008-01-27 Thread Phil Rhoades
Pavel, You didn't read my note properly - your query gives: 1 2 3 4 5 I want: 1 2 4 5 Phil. On Sun, 2008-01-27 at 15:10 +0100, Pavel Stehule wrote: > Hello > > try > > SELECT DISTINCT col FROM table > > Pavel > > On 27/01/2008, Phil Rhoades <[EMAIL PROTECTED]> wrote: > > People, > > > >

Re: [GENERAL] A select DISTINCT query?

2008-01-27 Thread Tino Wildenhain
Phil Rhoades wrote: People, I want to select from a table ONLY unique records ie if a column has values: 1 2 3 3 4 5 I want ONLY these records returned: 1 2 4 5 SELECT count(*) as cnt,a,b,c FORM yourtable GROUP BY a,b,c HAVING cnt=1 should do. Regards Tino ---(en

Re: [GENERAL] A select DISTINCT query?

2008-01-27 Thread Pavel Stehule
Hello try SELECT DISTINCT col FROM table Pavel On 27/01/2008, Phil Rhoades <[EMAIL PROTECTED]> wrote: > People, > > I want to select from a table ONLY unique records ie if a column has > values: > > 1 > 2 > 3 > 3 > 4 > 5 > > I want ONLY these records returned: > > 1 > 2 > 4 > 5 > > Thanks, > >

[GENERAL] A select DISTINCT query?

2008-01-27 Thread Phil Rhoades
People, I want to select from a table ONLY unique records ie if a column has values: 1 2 3 3 4 5 I want ONLY these records returned: 1 2 4 5 Thanks, Phil. -- Philip Rhoades Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275) GPO Box 3411 Sydney NSW 2001 Australia Fax: +61:(0)

Re: [GENERAL] Possible bug in PostgreSQL 8.3beta4 (postgres process segfaults)

2008-01-27 Thread Lawrence Oluyede
> I think we finally found the problem. Please see if things are more > stable with 8.3RC1 plus this patch: > > http://archives.postgresql.org/pgsql-committers/2008-01/msg00190.php Sorry for being so late. I'm currently using PostgreSQL RC2 at work and I notice no crashes. Thanks! -- Lawrence,

Re: [GENERAL] Very long execution time of "select nextval('..');"

2008-01-27 Thread Shane Ambler
[EMAIL PROTECTED] wrote: Unfortunatly i can not tell at which time this happens as the log doesn't show the time of day. Start with your postgresql.conf - http://www.postgresql.org/docs/8.2/interactive/runtime-config-logging.html points of interest :- log_min_messages - debug1 to get som

[GENERAL] Very long execution time of "select nextval('..');"

2008-01-27 Thread mljv
Hi, we run postgresql-8.1 on a dedicated debian box 64bit, dual-core CPU, 8GB RAM, RAID-1. We select our primary keys with select nextval before we actually insert a record. In my logs i print every statement which takes longer than 250ms there are lots of values fetched each day with nextval