Re: SELECTing every Nth record for better performance - Mailing list pgsql-general

From Richard Broersma
Subject Re: SELECTing every Nth record for better performance
Date
Msg-id 396486430912032150t447a315p55393e84f47fc276@mail.gmail.com
Whole thread Raw
In response to SELECTing every Nth record for better performance  (Tom <tom@cstcomposites.com>)
Responses Re: SELECTing every Nth record for better performance  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
List pgsql-general
On Thu, Dec 3, 2009 at 9:26 PM, Tom <tom@cstcomposites.com> wrote:

> I
> want run a query that skips every nth record and returns a managable
> dataset that still gives a correct overview of the data without
> slowing the programme down. Is there an easy way to do this that I
> have overlooked? I looked at:

I've played with datalogging.  It was very easy to find nth records
when using date_trunc() on a timestamp.   The only minor problem with
data_trunc was that I couldn't create arbitrary granularity.   For
example it is easy to date_trunc() on an year, month, week, day, hour
or a minute but I wanted 5, 10 and 15 minute increments.  I bet there
could be a solution to this, but I never looked into it.


To improve the select performance, I created functional indexes using
different data_trunc() granularities.

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

pgsql-general by date:

Previous
From: Tom
Date:
Subject: SELECTing every Nth record for better performance
Next
From: Tom Lane
Date:
Subject: Re: Installing PL/pgSQL by default