Deterministic stored functions in FB 3: provide ability to map input arguments 
to output values
-----------------------------------------------------------------------------------------------

                 Key: CORE-4361
                 URL: http://tracker.firebirdsql.org/browse/CORE-4361
             Project: Firebird Core
          Issue Type: Improvement
            Reporter: Pavel Zotov
            Priority: Minor


DDL:
set term ^;
recreate function fx(a_n int) returns varchar(31) deterministic as
begin
  return (select rt.rdb$type_name from rdb$types rt order by rt.rdb$type rows 
(:a_n) to (:a_n));
end
^set term ;^

Test-1: select fx(10) from rdb$formats rows 1
Trace-1:
select fx(10) from rdb$formats rows 1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PLAN (RDB$FORMATS NATURAL)
1 records fetched
      0 ms, 519 fetch(es)

Table                             Natural 
unge
******************************************
****
RDB$FORMATS                             1 

RDB$TYPES                             251 


Test-2: select fx(10) from rdb$formats rows 5;
Trace-2:

Statement 30:
------------------------------------------
select fx(10) from rdb$formats rows 5
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PLAN (RDB$FORMATS NATURAL)
5 records fetched
      1 ms, 2585 fetch(es)

Table                             Natural 
unge
******************************************
****
RDB$FORMATS                             5 

RDB$TYPES                            1255 

So, stored function re-reads RDB$TYPES table for each row of source. 
It will be good for performance if all input arguments will be mapped to output 
results of such functions.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to