dbTalk Databases Forums  

Split query

comp.databases.postgresql.general comp.databases.postgresql.general


Discuss Split query in the comp.databases.postgresql.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Katsaros Kwn/nos
 
Posts: n/a

Default Split query - 11-02-2004 , 12:47 AM






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

Reply With Quote
  #2  
Old   
Tino Wildenhain
 
Posts: n/a

Default Re: Split query - 11-02-2004 , 02:53 AM






Hi,

On Tue, 2004-11-02 at 07:47, Katsaros Kwn/nos wrote:
Quote:
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 majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly



Reply With Quote
  #3  
Old   
Katsaros Kwn/nos
 
Posts: n/a

Default Re: Split query - 11-02-2004 , 03:05 AM



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:
Quote:
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



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.