• SQLServer VO2.5 x VO2.8

    From Antonio Falcao Neto@21:1/5 to All on Thu Nov 11 11:52:58 2021
    Hello,
    I have a very old system on VO2.5 on SQLServer.
    I am switching to VO2.8. But performance on 2.8 is MUCH SLOWER.
    Does anyone have any idea how to improve?
    The code below takes 1s on VO25 and 27s on VO28. There are 2500 records

    local oConn as SQLConnection
    local cCon as string
    local cSQL as string
    local oSele as SQLSelect
    local aVal as array
    local cStart as string

    cCon:="DRIVER=SQL Server;SERVER=IP;UID=XaXaXaXa;PWD=PoPoPoPo;DATABASE=base"
    oConn := SQLConnection{}
    oConn:DriverConnect(,SQL_DRIVER_NOPROMPT,cCon) oConn:SetConnectOption(SQL_AUTOCOMMIT,1)

    cSQL:="select obr_uni_numero "+;
    "from obra_unidades "+;
    "where obr_numero=203 "+;
    "order by obr_uni_numero "+;

    cStart:=Time()
    oSele:=SQLSelect{cSQL,oConn}
    if oSele:Execute()

    aVal:={}
    do while !oSele:EoF
    AAdd(aVal,oSele:FIELDGET(#Obr_Uni_Numero))
    oSele:Skip()
    endd

    TextBox{,"",ElapTime(cInicio,Time())+"-"+Str1(Len(aVal))}:Show()

    endif

    oSele:Close()

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jamal@21:1/5 to Antonio Falcao Neto on Sat Nov 13 01:51:13 2021
    Antonio,

    What part is slow? Is it in the DO WHILE loop?

    You need to profile the FieldGET() and Skip() method and isolate which
    is slow.

    One option is to speed up the Skip() is by surrounding the DO WHILE loop
    with oSele:SuspendNotification() and oSele:ResetNotification() block;
    however, I'm not sure about this when dealing with SQL.


    Good Luck!
    Jamal



    On 11/11/2021 2:52 PM, Antonio Falcao Neto wrote:
    Hello,
    I have a very old system on VO2.5 on SQLServer.
    I am switching to VO2.8. But performance on 2.8 is MUCH SLOWER.
    Does anyone have any idea how to improve?
    The code below takes 1s on VO25 and 27s on VO28. There are 2500 records

    local oConn as SQLConnection
    local cCon as string
    local cSQL as string
    local oSele as SQLSelect
    local aVal as array
    local cStart as string

    cCon:="DRIVER=SQL Server;SERVER=IP;UID=XaXaXaXa;PWD=PoPoPoPo;DATABASE=base"
    oConn := SQLConnection{}
    oConn:DriverConnect(,SQL_DRIVER_NOPROMPT,cCon) oConn:SetConnectOption(SQL_AUTOCOMMIT,1)

    cSQL:="select obr_uni_numero "+;
    "from obra_unidades "+;
    "where obr_numero=203 "+;
    "order by obr_uni_numero "+;

    cStart:=Time()
    oSele:=SQLSelect{cSQL,oConn} > if oSele:Execute()

    aVal:={}
    do while !oSele:EoF
    AAdd(aVal,oSele:FIELDGET(#Obr_Uni_Numero))
    oSele:Skip()
    endd

    TextBox{,"",ElapTime(cInicio,Time())+"-"+Str1(Len(aVal))}:Show()

    endif

    oSele:Close()


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wolfgang Riedmann@21:1/5 to All on Sun Nov 14 13:52:41 2021
    Hi Antonio,

    I have a very old system on VO2.5 on SQLServer.
    I am switching to VO2.8. But performance on 2.8 is MUCH SLOWER.
    Does anyone have any idea how to improve?

    try to set

    SqlSetStmtCursorType( SQL_CURSOR_DYNAMIC )

    at the start of your program.

    Wolfgang


    --

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)