If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Pushing projection below selection

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-09-09, 00:06
humor_me humor_me is offline
Registered User
 
Join Date: Jun 2009
Posts: 2
Pushing projection below selection

It is mentioned in "Database System Implementation" , section 7.2.4 that when we push projections, it is quite usual for the projection to also remain where it is. Can there be situations where when we push projections, we need not retain the projection at the same place and yet obtain an equivalent logical query plan . For example if we have a relation A with attributes p,q,r and we have the following logical query plan :

Projection(p,q) (Selection(q=3)(A))

Would Selection(q=3) (Projection(p,q) (A)) be a equivalent logical query plan for the above logical query plan? i have pushed the projection down the tree without retaining the projection in its original place since ALL the attributes required by the selection are also included in the projection. Is this correct?
Reply With Quote
  #2 (permalink)  
Old 06-09-09, 15:08
dportas dportas is offline
Registered User
 
Join Date: Dec 2007
Location: London, UK
Posts: 732
Yes, your example is correct. In other examples the projection might eliminate some attribute required by another operator - I guess that's what your textbook is referring to.

In SQL systems (which are not closed under the relational algebra) the picture is also complicated because SQL has a "SELECT ALL" version of the "projection" operator that preserves duplicate rows. Query rewrite is bound to be a harder problem in SQL systems than in truly relational ones because of its multi-set rather than set-based model. So that may also be a consideration with projections in SQL systems.
Reply With Quote
  #3 (permalink)  
Old 06-09-09, 21:19
humor_me humor_me is offline
Registered User
 
Join Date: Jun 2009
Posts: 2
That was helpful. Thank you for your response. How would the equivalence of above 2 logical query plans be affected if we were dealing with multi-set rather than the set model? In other words, would the above 2 logical query plans NOT be equivalent if we were dealing with the multiset model? I am thinking they would still be equivalent.
Reply With Quote
  #4 (permalink)  
Old 06-10-09, 05:49
dportas dportas is offline
Registered User
 
Join Date: Dec 2007
Location: London, UK
Posts: 732
In your example the two plans are the same under the multiset model.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On