Skip site navigation (1) Skip section navigation (2)

Re: Array performance

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Ruben Rubio Rey <ruben(at)rentalia(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Array performance
Date: 2006-03-24 12:52:45
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
On Fri, Mar 24, 2006 at 01:41:50PM +0100, Ruben Rubio Rey wrote:
> Hi,
> I have a select like
> SELECT (array[20]+array[21]+ ... +array[50]+array[51]) as total
> FROM table
> (array[20]+array[21]+ ... +array[50]+array[51])<5000 might provide some useful
insights. I also recall seeing something about sum operators for arrays,
but I can't recall where.

> AND array[20]<>0
> AND array[21]<>0
> ...
> AND array[50]<>0
> AND array[51])<>0

Uhm... please don't tell me that you're using 0 in place of NULL...

You might be able to greatly simplify that by use of ANY; you'd need to
ditch elements 1-19 though:

... WHERE NOT ANY(array) = 0

Jim C. Nasby, Sr. Engineering Consultant      jnasby(at)pervasive(dot)com
Pervasive Software    work: 512-231-6117
vcard:       cell: 512-569-9461

In response to


pgsql-performance by date

Next:From: Jim C. NasbyDate: 2006-03-24 12:59:19
Subject: Re: Performance problems with multiple layers of functions
Previous:From: Svenne KrapDate: 2006-03-24 12:49:17
Subject: Performance problems with multiple layers of functions

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group