SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 65036: SAS® Customer Intelligence queries to five or more joined DBMS tables take a long time to execute

DetailsHotfixAboutRate It

If you are using SAS® Customer Intelligence Studio and selecting data that is joined with five or more tables, campaign results are generated after a much longer time than expected.

The issue occurs when all the following are true:

  • Five or more tables are involved in the join.
  • All the join criteria use the same column name.
  • The first table's join column is not used in all join criteria.
  • All the tables are in the same library.
  • The library is a database management system (DBMS) library, like Oracle or Teradata.

The performance issue occurs because the entire join is not performed in the database, so more data is pulled back to SAS® than expected. However, the final results are correct.

The only way to confirm that you are experiencing this issue is to enable the SASTRACE option, as shown here:

options sastrace=',,,d' sastraceloc=saslog nostsuffix ;

Additional messages are then written to the SAS log. The wording of the message that appears is dependent on the DBMS that is used. For example, with Oracle or Teradata, you might see a message that is similar to one of the following:

ACCESS ENGINE: ERROR: ORACLE prepare error: ORA-00918: column ambiguously defined

ACCESS ENGINE: ERROR: Teradata prepare: Duplication of column CLIENT_ID in a table, derived table, view, macro or trigger

Note: If you use SAS Customer Intelligence Studio, you need to enable additional logging. Contact SAS Technical Support and reference this SAS Note to obtain more details.

This issue can occur with any SQL procedure query that joins five or more tables that are in a DBMS. In most cases, the query can be restructured to avoid the performance degradation. The following code syntax provides an example of how to restructure the query.

Here is the original query:

proc sql;
   create table results as
      select table1.client_id as client_id label='client_id' format=13.
         from dbmslib.table1 table1
         left join dbmslib.table2 table2 on table1.client_id=table2.client_id
         left join dbmslib.table3 table3 on table2.client_id=table3.client_id
         left join dbmslib.table4 table4 on table2.client_id=table4.client_id
         left join dbmslib.table5 table5 on table2.client_id=table5.client_id
            where table3.attr is not null
            and table4.attr is not null
            and table5.attr is not null
; quit ;

In this case, change the query so that all the left joins use "table1.client_id" on the left side of the join criteria:

proc sql;
   create table results as
      select table1.client_id as client_id label='client_id' format=13.
         from dbmslib.table1 table1
         left join dbmslib.table2  table2 on table1.client_id=table2.client_id
         left join dbmslib.table3  table3 on table1.client_id=table3.client_id
         left join dbmslib.table4  table4 on table1.client_id=table4.client_id
         left join dbmslib.table5  table5 on table1.client_id=table5.client_id
            where table3.attr is not null
            and table4.attr is not null
            and table5.attr is not null
; quit ;

Click the Hot Fix tab in this note to access the hot fix for this issue.



Operating System and Release Information

Product FamilyProductSystemProduct ReleaseSAS Release
ReportedFixed*ReportedFixed*
SAS SystemBase SASz/OS9.4_M59.4 TS1M5
z/OS 64-bit9.4_M59.4 TS1M5
Microsoft® Windows® for x649.4_M59.4 TS1M5
Microsoft Windows 8 Enterprise 32-bit9.4_M59.4 TS1M5
Microsoft Windows 8 Enterprise x649.4_M59.4 TS1M5
Microsoft Windows 8 Pro 32-bit9.4_M59.4 TS1M5
Microsoft Windows 8 Pro x649.4_M59.4 TS1M5
Microsoft Windows 8.1 Enterprise 32-bit9.4_M59.4 TS1M5
Microsoft Windows 8.1 Enterprise x649.4_M59.4 TS1M5
Microsoft Windows 8.1 Pro 32-bit9.4_M59.4 TS1M5
Microsoft Windows 8.1 Pro x649.4_M59.4 TS1M5
Microsoft Windows 109.4_M59.4 TS1M5
Microsoft Windows Server 20089.4_M59.4 TS1M5
Microsoft Windows Server 2008 R29.4_M59.4 TS1M5
Microsoft Windows Server 2008 for x649.4_M59.4 TS1M5
Microsoft Windows Server 2012 Datacenter9.4_M59.4 TS1M5
Microsoft Windows Server 2012 R2 Datacenter9.4_M59.4 TS1M5
Microsoft Windows Server 2012 R2 Std9.4_M59.4 TS1M5
Microsoft Windows Server 2012 Std9.4_M59.4 TS1M5
Microsoft Windows Server 20169.4_M59.4 TS1M5
Windows 7 Enterprise 32 bit9.4_M59.4 TS1M5
Windows 7 Enterprise x649.4_M59.4 TS1M5
Windows 7 Home Premium 32 bit9.4_M59.4 TS1M5
Windows 7 Home Premium x649.4_M59.4 TS1M5
Windows 7 Professional 32 bit9.4_M59.4 TS1M5
Windows 7 Professional x649.4_M59.4 TS1M5
Windows 7 Ultimate 32 bit9.4_M59.4 TS1M5
Windows 7 Ultimate x649.4_M59.4 TS1M5
64-bit Enabled AIX9.4_M59.4 TS1M5
64-bit Enabled Solaris9.4_M59.4 TS1M5
HP-UX IPF9.4_M59.4 TS1M5
Linux for x649.4_M59.4 TS1M5
Solaris for x649.4_M59.4 TS1M5
* 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.