469,090 Members | 1,112 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,090 developers. It's quick & easy.

Split query

Hi!

I want to parse a query (SFW) and create new queries: one for each table referenced, if that possible.
I've written a function for this in the Query struct level after parse&rewrite (not very general ofcourse :-)) but I would like to know whether there is any code written for this purpose at any level. Are there any algorithms for this?
Following, is there any code or at least some algorithm about merging the individual results returned from these queries?

Thanks in advance!
Ntinos Katsaros
Nov 23 '05 #1
4 4676
Hi,

On Tue, 2004-11-02 at 07:47, Katsaros Kwn/nos wrote:
Hi!

I want to parse a query (SFW) and create new queries: one for each
table referenced, if that possible.
I've written a function for this in the Query struct level after
parse&rewrite (not very general ofcourse :-)) but I would like to
know whether there is any code written for this purpose at any level.
Are there any algorithms for this?
Following, is there any code or at least some algorithm about merging
the individual results returned from these queries?


The latter is easy. Consider:

SELECT ... FROM
(SELECT ... first query here) AS table_a
JOIN
(SELECT ... second query here) AS table_b
USING (same_column);

(or ON table_a.column = table_b.column)

I dont think you should think about joining results
outside the database. You have Postgresql here, remember :-)

Regards
Tino
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #2
Hi,

On Tue, 2004-11-02 at 07:47, Katsaros Kwn/nos wrote:
Hi!

I want to parse a query (SFW) and create new queries: one for each
table referenced, if that possible.
I've written a function for this in the Query struct level after
parse&rewrite (not very general ofcourse :-)) but I would like to
know whether there is any code written for this purpose at any level.
Are there any algorithms for this?
Following, is there any code or at least some algorithm about merging
the individual results returned from these queries?


The latter is easy. Consider:

SELECT ... FROM
(SELECT ... first query here) AS table_a
JOIN
(SELECT ... second query here) AS table_b
USING (same_column);

(or ON table_a.column = table_b.column)

I dont think you should think about joining results
outside the database. You have Postgresql here, remember :-)

Regards
Tino
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #3
Well, the second question is trivial indeed :-) ,even though I had
pipelining in mind when writting it...
(which is not so query oriented but rather plan/executor oriented)
However, I'm more interested in the first question.

Thank you very much,
Ntinos
Tino Wildenhain wrote:
Hi,

On Tue, 2004-11-02 at 07:47, Katsaros Kwn/nos wrote:
Hi!

I want to parse a query (SFW) and create new queries: one for each
table referenced, if that possible.
I've written a function for this in the Query struct level after
parse&rewrite (not very general ofcourse :-)) but I would like to
know whether there is any code written for this purpose at any level.
Are there any algorithms for this?
Following, is there any code or at least some algorithm about merging
the individual results returned from these queries?


The latter is easy. Consider:

SELECT ... FROM
(SELECT ... first query here) AS table_a
JOIN
(SELECT ... second query here) AS table_b
USING (same_column);

(or ON table_a.column = table_b.column)

I dont think you should think about joining results
outside the database. You have Postgresql here, remember :-)

Regards
Tino

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #4
Well, the second question is trivial indeed :-) ,even though I had
pipelining in mind when writting it...
(which is not so query oriented but rather plan/executor oriented)
However, I'm more interested in the first question.

Thank you very much,
Ntinos
Tino Wildenhain wrote:
Hi,

On Tue, 2004-11-02 at 07:47, Katsaros Kwn/nos wrote:
Hi!

I want to parse a query (SFW) and create new queries: one for each
table referenced, if that possible.
I've written a function for this in the Query struct level after
parse&rewrite (not very general ofcourse :-)) but I would like to
know whether there is any code written for this purpose at any level.
Are there any algorithms for this?
Following, is there any code or at least some algorithm about merging
the individual results returned from these queries?


The latter is easy. Consider:

SELECT ... FROM
(SELECT ... first query here) AS table_a
JOIN
(SELECT ... second query here) AS table_b
USING (same_column);

(or ON table_a.column = table_b.column)

I dont think you should think about joining results
outside the database. You have Postgresql here, remember :-)

Regards
Tino

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by uc_sk | last post: by
8 posts views Thread by middletree | last post: by
8 posts views Thread by ronrsr | last post: by
12 posts views Thread by garyusenet | last post: by
reply views Thread by =?ISO-8859-15?Q?C=E9dric?= | last post: by
5 posts views Thread by kumarboston | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.