Aktivieren Sie die Trace-Optionen, um das vom LIBNAME-Modul generierte SQL zu sehen:
options sastrace=',,,d' sastraceloc=SASLOG;
1
options sastrace=',,,d' sastraceloc=SASLOG;
Wenn Sie eine komplexe SQL-Abfrage mit Ihren JOIN und WHERE im Protokoll sehen: Das LIBNAME-Modul funktioniert gut (Implizites Pass-Through erfolgreich). Das Problem könnte an fehlenden Datenbankindizes liegen.
Nachteil: Sie verlieren die Portabilität (der Code wird spezifisch für Oracle/SQL Server/usw.).
proc sql;
connect to oracle (user=... password=... path=...);
create table want as
select * from connection to oracle
(
SELECT A.id, B.value
FROM tableA A
INNER JOIN tableB B ON A.id = B.id
/* Ce code est exécuté par Oracle, pas SAS */
);
disconnect from oracle;
quit;
1
PROC SQL;
2
connect to oracle (user=... password=... path=...);
Verlassen Sie sich nicht auf Ihre Uhr. Verwenden Sie die integrierten Benchmarking-Tools, um Ihre Tests (LIBNAME vs. Pass-Through vs. Data Step) zu vergleichen:
options FULLSTIMER;: Zeigt im Protokoll die CPU-Zeit, die reale Zeit und den verwendeten Speicher für jeden Schritt an.
Es gibt keine Magie, nur vergleichende Tests (FULLSTIMER) in Ihrer spezifischen Umgebung.
Zur Optimierung Ihrer massiven Joins:
Prüfen Sie zuerst mit SASTRACE, ob LIBNAME seine Aufgabe erfüllt.
Testen Sie das explizite Pass-Through, wenn das implizite fehlschlägt.
Schließen Sie die Option nicht aus, Datensubsets abzurufen, um einen lokalen MERGE durchzuführen, falls der Datenbankserver überlastet ist.
Important Disclaimer
The codes and examples provided on WeAreCAS.eu are for educational purposes. It is imperative not to blindly copy-paste them into your production environments. The best approach is to understand the logic before applying it. We strongly recommend testing these scripts in a test environment (Sandbox/Dev). WeAreCAS accepts no responsibility for any impact or data loss on your systems.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.