Page 1 of 1

FW_OpenRecordSet lento en red

PostPosted: Sun Dec 17, 2023 11:50 pm
by jpcavagnaro
Hola gente, estoy teniendo problemas se pone muy lento en red es una constulta muy sencilla:

cSQL := "SELECT top 20 numero,nombre,domic FROM clientes"
oRs1 := FW_OpenRecordSet( oCn, cSQL )

de que manera puedo acelerar esto, porque se pone muy lento.

Re: FW_OpenRecordSet lento en red

PostPosted: Mon Dec 18, 2023 12:30 am
by Rick Lipkin
Jeorge

Try the old fashoned way where you set the Recordset properties manually ...

Code: Select all  Expand view

oRs1 := TOleAuto():New( "ADODB.Recordset" )
oRs1:CursorType     := 1        // opendkeyset
oRs1:CursorLocation := 3       // local cache
oRs1:LockType       := 3         // lockoportunistic

TRY
   oRs1:Open(cSQL,oCn )
CATCH oErr
   MsgInfo( "Error in Opening CLIENTS table" )
   RETURN(.F.)
END TRY


 


Rick Lipkin

Re: FW_OpenRecordSet lento en red

PostPosted: Mon Dec 18, 2023 6:06 am
by nageswaragunupudi
Rick Lipkin wrote:Jeorge

Try the old fashoned way where you set the Recordset properties manually ...

Code: Select all  Expand view

oRs1 := TOleAuto():New( "ADODB.Recordset" )
oRs1:CursorType     := 1        // opendkeyset
oRs1:CursorLocation := 3       // local cache
oRs1:LockType       := 3         // lockoportunistic

TRY
   oRs1:Open(cSQL,oCn )
CATCH oErr
   MsgInfo( "Error in Opening CLIENTS table" )
   RETURN(.F.)
END TRY


 


Rick Lipkin


This is what FW_OpenRecordSet( oCn, cSql ) function does.
What is the extra thing you are doing to speed up the query?

Another important information to all of u:
Whatever value we specify for oRs:CursorType, ADO invariably opens the recordset as adOpenStatic only for CursorLocation adUseClient.
There is not point in assigning a value like adOpenKeySet or adOpenDynamic

Re: FW_OpenRecordSet lento en red

PostPosted: Mon Dec 18, 2023 6:07 am
by nageswaragunupudi
jpcavagnaro wrote:Hola gente, estoy teniendo problemas se pone muy lento en red es una constulta muy sencilla:

cSQL := "SELECT top 20 numero,nombre,domic FROM clientes"
oRs1 := FW_OpenRecordSet( oCn, cSQL )

de que manera puedo acelerar esto, porque se pone muy lento.


When we use TOP n, it is desirable to use ORDER BY clause.

Re: FW_OpenRecordSet lento en red

PostPosted: Mon Dec 18, 2023 4:04 pm
by Armando
Friends:

In addition to the ORDER BY clause, try using the LIMIT 20 clause.

Best regards

Re: FW_OpenRecordSet lento en red

PostPosted: Mon Dec 18, 2023 4:40 pm
by nageswaragunupudi
Armando wrote:Friends:

In addition to the ORDER BY clause, try using the LIMIT 20 clause.

Best regards


He is already using TOP 20 clause.

Re: FW_OpenRecordSet lento en red

PostPosted: Mon Dec 18, 2023 5:42 pm
by Armando
Mr. Rao:

You are right, it is just to see if the LIMIT 20 clause gains speed.

Greetings

Re: FW_OpenRecordSet lento en red

PostPosted: Mon Dec 18, 2023 6:20 pm
by nageswaragunupudi
MySql : LIMIT n
MsSql : TOP n

Re: FW_OpenRecordSet lento en red

PostPosted: Mon Dec 18, 2023 6:36 pm
by jpcavagnaro
Gracias por responder, probe con order by y sigue lento.

En forma local funciona rápido, pero cuando trabajo desde un terminal se pone lento y si la pc no es muy nueva lentísima, recuerdo que es para facturar, o sea que debe tener respuesta rápida.