Problem Note 44069: Performance might be affected if your query joins multiple tables or views in which variables are being renamed
Performance problems might occur when you process a query in which you rename a variable and then use that renamed variable later in your query in a subquery.
In the following code example, two views that contain the same variable names are created. In the view work.v3, the two preceding views are joined and one of the common variables is renamed so that both instances of the variable VAR3 could be kept. In the work.final query, the new variable name is used in the subquery. Rather than referencing the new name, the query being passed to the database references the original variable name. This results in a syntax error from the database. SAS retrieves the data for each of the tables that make up the query and proceeds to process the query within SAS
®. As a result, the query might take longer to run than if it had been processed by the database.
proc sql;
create view work.v1 as
select B2.var1 ,
B2.var2,
H2.var3
from DBMSLIB.mba1 as B2
inner join DBMSLIB.mba2 as H2
on B2.var1 = H2.var6 ;
create view work.v2 as
select B1.var1 ,
B1.var2 ,
H1.var3
from DBMSLIB.mba1 as B1
inner join DBMSLIB.mba2 as H1
on B1.var2 = H1.var6;
create view work.v3 as
select v2.var3 as v2 ,
v1.var3 as v1
from work.v1
inner join work.v2
on v1.var1 = v2.var1 and v1.var2 = v2.var2;
create table work.final as
select v3.v2 ,
v3.v1
from work.v3
where NOT EXISTS (select 1 as dummy
from DBMSLIB.mba3 as L1
where L1.var7 = v3.v2 and L1.var8 = v3.v1 ) ;
quit ;
Click the Hot Fix tab in this note to access the hot fix for this issue.
Operating System and Release Information
SAS System | Base SAS | z/OS | 9.1 TS1M3 SP4 | 9.4 TS1M0 |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows XP 64-bit Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Advanced Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Server | 9.1 TS1M3 SP4 | |
Microsoft Windows 2000 Professional | 9.1 TS1M3 SP4 | |
Microsoft Windows NT Workstation | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M3 SP4 | |
Microsoft Windows XP Professional | 9.1 TS1M3 SP4 | |
Windows Vista | 9.1 TS1M3 SP4 | |
Windows Vista for x64 | 9.1 TS1M3 SP4 | |
64-bit Enabled AIX | 9.1 TS1M3 SP4 | 9.4 TS1M0 |
64-bit Enabled HP-UX | 9.1 TS1M3 SP4 | 9.4 TS1M0 |
64-bit Enabled Solaris | 9.1 TS1M3 SP4 | 9.4 TS1M0 |
HP-UX IPF | 9.1 TS1M3 SP4 | |
Linux | 9.1 TS1M3 SP4 | |
Linux on Itanium | 9.1 TS1M3 SP4 | |
OpenVMS Alpha | 9.1 TS1M3 SP4 | |
Solaris for x64 | 9.1 TS1M3 SP4 | 9.4 TS1M0 |
Tru64 UNIX | 9.1 TS1M3 SP4 | 9.4 TS1M0 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Type: | Problem Note |
Priority: | high |
Date Modified: | 2011-10-05 08:59:24 |
Date Created: | 2011-08-22 15:30:39 |