pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joseph Turner <joseph.turner@oakleynetworks.com>
To: pgsql-sql@postgresql.org
Subject: Selecting "sample" data from large tables.
Date: Thu, 3 Jun 2004 11:31:22 -0600
Message-ID: <200406031131.24535.joseph.turner@oakleynetworks.com> (raw)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have a table with a decent number of rows (let's say for example a
billion rows).  I am trying to construct a graph that displays the
distribution of that data.  However, I don't want to read in the
complete data set (as reading a billion rows would take a while).  Can
anyone thing of a way to do this is postgresql?  I've been looking
online and most of the stuff I've found has been for other databases.
As far as I can tell ANSI SQL doesn't provide for this scenario.

I could potentially write a function to do this, however I'd prefer
not to.  But if that's what I'm going to be stuck doing I'd like to
know earlier then later.  Here's the description of the table:

create table score
{
  pageId Integer NOT NULL,
  ruleId, Integer NOT NULL
  score Double precision NULL,
  rowAddedDate BigInt NULL,
 primary key (pageId, ruleId)
};

I also have an index on row added date, which is just the number of
millis since the epoc (Jan 1, 1970 or so [java style timestamps]).
I'd be willing to accept that the row added date values are random
enough to represent random.

Thanks in advance,

  -- Joe T.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAv2Bqs/P36Z9SDAARAkmLAJ9dDB0sqACgFrxH8NukFUsizXz5zgCgt9IT
/wh3ryz4WQzc5qQY2cAZtVE=
=5dg+
-----END PGP SIGNATURE-----



view thread (3+ messages)  latest in thread

Message-ID: <200406031131.24535.joseph.turner@oakleynetworks.com>
Permalink:  ../200406031131.24535.joseph.turner@oakleynetworks.com/
Also on:    postgresql.org/message-id/200406031131.24535.joseph.turner@oakleynetworks.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: joseph.turner@oakleynetworks.com
  Subject: Re: Selecting "sample" data from large tables.
  In-Reply-To: <200406031131.24535.joseph.turner@oakleynetworks.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox