Query Sampling

From: Varun Kacholia <kacholia(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Query Sampling
Date: 2005-08-28 00:00:10
Message-ID: 500f006105082717002d6edf89@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi everybody,
I would like to add query sampling support to postgresql (atleast as a part of
my project, if someone feels strongly against checking it in the main branch).
I have been going over the code and I do see a lot of sampling stuff
in backend/commands/analyze.c. However, I plan to add sampling support
to the
executor, allowing the following types of queries:

SELECT STORE, AVG(SALES) FROM TRANSACTIONS TABLESAMPLE
BERNOULLI(10) REPEATABLE(5) GROUP BY STORE

(This is supported by DB2).

For starters I think this should be doable in the executor by cannibalizing
nodeSeqscan.c and adding sampling support to it.
However I am concerned about the planner optimizations as it might decide
to run an index scan (instead of a sequential scan) for a particular
base relation.
My question is: Is there any easy way of forcing the optimizer to
choose sequential
scan for a particular relation? (I apologize if this is documented in
the planner code
as I am still going over it).
I would appreciate any other comments.

Thanks much,
Varun

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chris Browne 2005-08-28 03:49:41 Re: Call for 7.5 feature completion
Previous Message David Fetter 2005-08-27 23:50:49 == PostgreSQL Weekly News - August 27 2005 ==