Feature Requests item #2220597, was opened at 2008-11-04 13:07
Message generated for change (Comment added) made by mlkersten
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482471&aid=2220597&group_id=56967

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: SQL - general
Group: None
Status: Open
Priority: 5
Private: No
Submitted By: Stefan de Konink (skinkie)
Assigned to: Nobody/Anonymous (nobody)
Summary: [Performance] Reduce duplicate subqueries in one query

Initial Comment:
I think a significant performance gain can be achieved if the SQL parser would 
'deduplicate' equal subqueries. The most trivial scenario would be a 'union 
all' with 10 equal queries next to eachother. The amount of time taken for 
processing this query (measured by more than 450 attributes) seems to be equal 
to executing each query individually. With my naive knowledge I think a 
programmer would 'assume' an atomic query. Hence all different subqueries 
should result in the same result under the hood.

Now one could argue, deduplicate at layer 8 ;) True; But it would a nifty 
feature if one could just get the optimization from SQL without changing 
queries that were explicitly executed in this sequence to align with previous 
results.

----------------------------------------------------------------------

>Comment By: Martin Kersten (mlkersten)
Date: 2008-11-18 14:13

Message:
The commenterm expression optimizer is on by default.

A snippet of your code to ensure that the plans are 
indeed not recognized are welcome.


----------------------------------------------------------------------

Comment By: Stefan de Konink (skinkie)
Date: 2008-11-18 11:08

Message:
@Martin; Should it be explicitly enabled? Because I highly doubt it is
working.

@Fabian; Of course I could catch it in the program that is actually
dynamically generating the mess. But the thing is I want it to be simple to
process the output.

----------------------------------------------------------------------

Comment By: Martin Kersten (mlkersten)
Date: 2008-11-18 09:55

Message:
if the subquery is really identical then the MAL optimizer
will/should catch it. And the recycler would further reduce
the work as well.

----------------------------------------------------------------------

Comment By: Fabian (mr-meltdown)
Date: 2008-11-18 09:39

Message:
Perhaps it is easier to use the

USING SELECT xxx AS y
SELECT * FROM y UNION SELECT * FROM y;

or similar syntax.  (I'm not sure if I got the syntax right.)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482471&aid=2220597&group_id=56967

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to