Abel Magana · 16 hr ago go to post

y este SQL a través de la vista que usé para entrenar el modelo también va super rápido:
por la vista

Abel Magana · 20 hr ago go to post

Hola
Mirando el plan no puedo deducir nada, mira cuando le pongo un solo pedido y va directo al registro, le sigue costando el mismo tiempo que con miles de registros, cuando el coste relativo es solo de 200. Estos son los datos de un SQL de prueba para un solo registro de la tabla persistente principal yendo con el ID directo:
 

SELECT 
 PROBABILITY(MLPedidosDesvEntrega for ('7-15')),

PREDICT(MLPedidosDesvEntrega),PROBABILITY(MLPedidosFabEntrega for ('5-10')),

PREDICT(MLPedidosFabEntrega)

FROM (Select cast(PEDL_MatrizDR as Integer) as Matriz,
cast(Decode(PEDL_LongitudCorte,PEDL_LongitudCorteFabricar,0,1) as INTEGER) as LlevaCorte,
CAST(PEDLPrensaPrevisibleDR as VARCHAR) as Prensa,
CAST(PEDL_ColorAcabadoDR->ACA_ClaseAcabado as VARCHAR) as ClaseAcabado, 
Sistema.Util_ObtenerNombreMesFecha(PEDL_PED_RowPR->PED_FechaEntregaInt) as MesAceptacion from SqlUser.VTA_PedidoLinea where PEDL_RowID='2021000278||1') 

Abajo se muestra el plan de ejecución:
Texto Sentencia
SELECT PROBABILITY ( MLPedidosDesvEntrega FOR ( ? ) ) , PREDICT ( MLPedidosDesvEntrega ) , PROBABILITY ( MLPedidosFabEntrega FOR ( ? ) ) , PREDICT ( MLPedidosFabEntrega ) FROM ( SELECT CAST ( PEDL_MatrizDR AS INTEGER ) AS Matriz , CAST ( Decode ( PEDL_LongitudCorte , PEDL_LongitudCorteFabricar , ? , ? ) AS INTEGER ) AS LlevaCorte , CAST ( PEDLPrensaPrevisibleDR AS VARCHAR ) AS Prensa , CAST ( PEDL_ColorAcabadoDR -> ACA_ClaseAcabado AS VARCHAR ) AS ClaseAcabado , Sistema . Util_ObtenerNombreMesFecha ( PEDL_PED_RowPR -> PED_FechaEntregaInt ) AS MesAceptacion FROM SqlUser . VTA_PedidoLinea WHERE PEDL_RowID = ? ) /*#OPTIONS {"DynamicSQLTypeList":"1,1,10,10,1"} */
Advertencia
• The following System-wide SQL Configuration Setting, which impacts the SQL Query Plan, has been changed from its default value: AutoParallel: 0 (Disabled) [DEFAULT: 1 (Enabled)]
Plan de consulta
Coste relativo = 200 • Call module B, which populates temp-file A. • Apply model MLPedidosDesvEntrega predictions to all rows in temp-file A. • Apply model MLPedidosDesvEntrega predictions to all rows in temp-file A. • Apply model MLPedidosFabEntrega predictions to all rows in temp-file A. • Apply model MLPedidosFabEntrega predictions to all rows in temp-file A. • Read temp-file A, looping on a counter. • For each row: - Output the row.
Module: B
• Read master map SQLUser.VTA_PedidoLinea.DataMasterMap, using the given idkey value. • Read master map SQLUser.CNG_Acabado(VTA_PEDIDOLINEA.PEDL_COLORACABADODR->).DataMasterMap, using the given idkey value. • Test the NOT NULL condition on ACA_RowID. • Generate a row padded with NULL for table SQLUser.CNG_Acabado if no row qualified. • Read master map SQLUser.VTA_Pedido(VTA_PEDIDOLINEA.PEDL_PED_ROWPR->).DataMasterMap, using the given idkey value. • Test the NOT NULL condition on PED_RowID. • Generate a row padded with NULL for table SQLUser.VTA_Pedido if no row qualified. • Add a row to temp-file A, subscripted by a counter, with node data of ACA_ClaseAcabado, PEDLPrensaPrevisibleDR, PEDL_LongitudCorte, PEDL_LongitudCorteFabricar, PEDL_MatrizDR, PED_FechaEntregaInt, [expression], [value], the 'CAST_INT' expression, the 'CAST_VARCHAR' expression, and the 'USERDEFINEDFUNCTION:Sistema.Util:ObtenerNombreMesFecha:SISTEMA.UTIL_OBTENERNOMBREMESFECHA:0' expression.