SQL Procedure vs. RUNSQLSTMT - IBM AS400

This is a discussion on SQL Procedure vs. RUNSQLSTMT - IBM AS400 ; I bet someone knows before I launch into a bunch of testing... Will a procedure run faster then identical code ran via a RUNSQLSTMT. If so, is it a lot faster or just a few nanoseconds between friends?...

+ Reply to Thread
Results 1 to 3 of 3

Thread: SQL Procedure vs. RUNSQLSTMT

  1. SQL Procedure vs. RUNSQLSTMT

    I bet someone knows before I launch into a bunch of testing... Will a
    procedure run faster then identical code ran via a RUNSQLSTMT. If so,
    is it a lot faster or just a few nanoseconds between friends?


  2. Re: SQL Procedure vs. RUNSQLSTMT

    Mike LaFountain wrote:
    > I bet someone knows before I launch into a bunch of testing... Will a
    > procedure run faster then identical code ran via a RUNSQLSTMT. If so,
    > is it a lot faster or just a few nanoseconds between friends?


    I don't know, but I'm guessing the procedure will run
    faster, because it's a compiled C program. I have no
    idea what the speed difference might be, if any.

  3. Re: SQL Procedure vs. RUNSQLSTMT

    On 8 Giu, 22:01, Mike LaFountain wrote:
    > I bet someone knows before I launch into a bunch of testing... Will a
    > procedure run faster then identical code ran via a RUNSQLSTMT. If so,
    > is it a lot faster or just a few nanoseconds between friends?


    It depends: I think that normally a stored procedure is faster because
    it uses static SQL. RUNSQLSTMT uses SQL Dynamic and the query must be
    optimized every time you run the statement (except if you use latest
    version of OS/400): if the query is very complex (join of many tables)
    the optimization can take some seconds... Moreover the second phase
    (open the data path) can be faster using a stored procedure because SP
    reuses Open data path. Dynamic SQL (RUNSQLSTMT) can not reuses ODP.


+ Reply to Thread