I built a wrapper function that currently just calls another table-valued Function but it just added a huge amount to the execution time as Client processing time. Is there a faster way to do this?
Wrapper function:
CREATE FUNCTION [console].[getCalculosRequisita]
(
@Disponivel BIGINT,
@mediaDiaria float,
@DiasStockArtigo INT,
@DiasAntes INT,
@SaidasPorMes float,
@QtdEncomendada2Meses BIGINT,
@StockAtual BIGINT,
@QtdRequisitada BIGINT,
@caixaMinima INT
)
RETURNS @tbl TABLE
(
DiasAteRotura INT,
AcaoRequisita varchar(10),
Aconselhada BIGINT
)
AS
BEGIN
--future configuration check
--future log input
INSERT INTO @tbl SELECT DiasAteRotura, AcaoRequisita,Aconselhada
FROM [cartridge].[getCalculosRequisitaTSQL]
(
@Disponivel ,
@mediaDiaria ,
@DiasStockArtigo ,
@DiasAntes ,
@SaidasPorMes ,
@QtdEncomendada2Meses ,
@StockAtual ,
@QtdRequisitada ,
@caixaMinima
)
--future log output
RETURN
END
GO
question from:https://stackoverflow.com/questions/65936701/wrapper-tsql-table-valued-function-is-slow