Date: Tue, 4 Oct 2005 12:55:39 -0700
Reply-To: David L Cassell <davidlcassell@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David L Cassell <davidlcassell@MSN.COM>
Subject: Re: Understanding Execution Plan from SQL Optimizer
Content-Type: text/plain; format=flowed
>Hi all, I am trying to understand a query that I am having a problem
>with. I have used the same technique in a program before, but it is
>executing different now. The SQL shows like this:
>/* get the purchase dates in a way we can
> show the difference in days */
>create table cycle1 as
> (select min(pdate)
> from &dataset as y
> where pdate > x0.pdate and
> x0.customer_id = y.customer_id
> ) as next,
> &dataset as x0
> pdate >= &periodstart
>Now I thought SAS created a temporary table for the subquery before,
>but it doesn't seem to be doing it this time. I'll show _method and
>Now, it mostly makes sense, but it's terribly inefficient. Also, I
>couldn't find a reference that shows what "SUBC" is in the execution
>tree. Can anybody suggest something to change the way this is running?
I see that Ian has spoken. So what more needs to be said?
Okay, I still can't shut up.
One thing you need to think about is the SQL Optimizer. The optimization is
likely to change as the underlying data needs drive it. We've talked about
in SAS-L before, when allocating enough buffer space has suddenly allowed
PROC SQL to use a hash to speed up processing, instead of having to resort
to a less-than optimal merge. I believe Paul Dorfman has given concrete
of this. So the optimizer may change the methods if the data sets grow, or
shrink, or change shape. So the difference you may be seeing may be due
to the sizes of the data sets, rather than anything you did to the system.
David L. Cassell
3115 NW Norwood Pl.
Corvallis OR 97330
Donít just search. Find. Check out the new MSN Search!