Re: [SQL] overload

2011-07-08 Thread lists-pgsql
Hi Viktor, I'm not sure what your requirements are in terms of performance and stability of the your result set. See Pavel's response. A cursor issues a single query and renders a single result set. The result set is static, the cursor just gives you finer control/performance when retrieving rows

Re: [SQL] overload

2011-07-08 Thread lists-pgsql
I'm have the same situation with large tables. Take a look at using a cursor to fetch several thousand rows at a time. I presume what's happening is that perl is attempting to create a massive list/array in memory. If you use a cursor the list should only contain X number of rows where X in the

Re: [SQL] Usage of function retruning record in query

2011-07-04 Thread lists-pgsql
Never mind, turns out you can do it with the array subscript operator. I stumbled on to this by chance. I don't know if this is in the documentation somewhere and I perhaps missed it? On Mon, Jul 04, 2011 at 02:31:52PM -0400, lists-pg...@useunix.net wrote: > Sorry, I don't have a useful answer but

Re: [SQL] Usage of function retruning record in query

2011-07-04 Thread lists-pgsql
Sorry, I don't have a useful answer but I have a similar question. Along these same lines how does one access the discreet x,y components of type 'point'? On Mon, Jul 04, 2011 at 06:59:49AM -0700, gmb wrote: > > Harald Fuchs-10 wrote: > > In article <1309762075448-4549140.p...@n5.nabble.com>,gm

Re: [SQL] selecting records X minutes apart

2011-06-05 Thread lists-pgsql
Thank you all who replied!! It looks like Sugawara's recursive solution does the trick. Unfortunately performance is quite poor for the sample dataset I'm working with which is a table of about 5 records. Indeed, there are indexes applied to the table. I believe the recursive select is bein

Re: [SQL] selecting records X minutes apart

2011-06-04 Thread lists-pgsql
Let's a take a look at just the input set for ID 0. 0       20:00 0       20:05 0       20:08 0       20:10 I want records, starting from the oldest record (20:00), that are at least 5 minutes apart. So 20:00, 20:05, 20:10 but 20:08 - 20:05 is only 3 minutes so it is to be ignored. I was hoping

Re: [SQL] selecting records X minutes apart

2011-06-04 Thread lists-pgsql
Did you mean WHERE in place of your first AND? If so I already had something like this but it only returns one set, the oldest group of entries for each ID. On Sat, Jun 04, 2011 at 01:09:39PM -0700, Richard Broersma wrote: > On Sat, Jun 4, 2011 at 12:15 PM, wrote: > >  I want to > > select rec

Re: [SQL] selecting records X minutes apart

2011-06-04 Thread lists-pgsql
On Sat, Jun 04, 2011 at 11:45:08AM +, Jasen Betts wrote: > On 2011-06-03, lists-pg...@useunix.net wrote: > > > > ID TS (HH:MM) > > --- > > 0 20:00 > > 0 20:05 > > 0 20:10 > > 1 20:03 > > 1 20:09 > > > > > > Does my question make sense? > > no, why is (1,20:04) exclu

Re: [SQL] selecting records X minutes apart

2011-06-04 Thread lists-pgsql
The TS column type is actually a timestamp with out timezone and yes I want to take seconds into account so both of your entries would be included in the result. On Fri, Jun 03, 2011 at 06:01:53PM -0700, Kevin Crain wrote: > Will you be using a full timestamp with that or are you only concerned >

[SQL] selecting records X minutes apart

2011-06-03 Thread lists-pgsql
I have a table that, at a minimum, has ID and timestamp columns. Records are inserted into with random IDs and timestamps. Duplicate IDs are allowed. I want to select records grouped by ID, ordered by timestamp that are X minutes apart. In this case X is 5. Note, the intervals are not X minute

[SQL] How to find entries missing in 2nd table?

2006-07-11 Thread alex-lists-pgsql
Hi, I realize I probably lost my marbles but I've been having a god awful time with a single query: control: controller_id pk; datapack: controller_id fk; I need to get all entries from the table contr

[SQL] executing external command

2006-03-16 Thread alex-lists-pgsql
Is there a way to execute an external i.e. system command from inside a pl/pgsql function? Alex ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's data

[SQL] stored procedures for complex SELECTs

2006-01-18 Thread alex-lists-pgsql
Are there performance advantages that can be achieved by wrapping a complex SELECT into a stored procedure? Alex ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] INSERT waiting under heavy load

2006-01-06 Thread alex-lists-pgsql
> > After digging through all the discussions of "INSERT waiting" problems I am > > still not clear about the concensus about solving it. > > ... > > The only thing that I do not particulary like is that every INSERT > > into this table has to adjust a counter column in a corresponding row of the >

[SQL] INSERT waiting under heavy load

2006-01-06 Thread alex-lists-pgsql
After digging through all the discussions of "INSERT waiting" problems I am still not clear about the concensus about solving it. I am running ration 6:1 SELECT:INSERT (insert fires up an UPDATE trigger that hits a column in a table holding keys used by SELECT). I am looking at doing about 2,00