Created
January 29, 2019 18:24
-
-
Save mujahidk/cf5ede87f44891a9e4fb858d0836dad0 to your computer and use it in GitHub Desktop.
Oracle PL/SQL block to run a query multiple times and measure time.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET TIMING ON | |
DECLARE | |
START_TIME PLS_INTEGER; | |
COUNT_ROW NUMBER; | |
BEGIN | |
FOR I IN 1..10 LOOP | |
START_TIME := DBMS_UTILITY.GET_TIME(); | |
SELECT COUNT(*) INTO COUNT_ROW FROM (SELECT * FROM PERSON ORDER BY LASTNAME ASC) WHERE ROWNUM <= 50; | |
DBMS_OUTPUT.PUT_LINE('Selected ' || COUNT_ROW || ' in ' || (DBMS_UTILITY.GET_TIME() - START_TIME) || '/100 seconds'); | |
END LOOP; | |
END; | |
/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment