FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FW_OpenRecordSet lento en red
Posts: 155
Joined: Tue Dec 30, 2008 03:07 AM
FW_OpenRecordSet lento en red
Posted: Sun Dec 17, 2023 11:50 PM

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.

Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: FW_OpenRecordSet lento en red
Posted: Mon Dec 18, 2023 12:30 AM
Jeorge

Try the old fashoned way where you set the Recordset properties manually ...
Code (fw): Select all Collapse
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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FW_OpenRecordSet lento en red
Posted: Mon Dec 18, 2023 06:06 AM
Rick Lipkin wrote:Jeorge

Try the old fashoned way where you set the Recordset properties manually ...
Code (fw): Select all Collapse
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
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FW_OpenRecordSet lento en red
Posted: Mon Dec 18, 2023 06:07 AM
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.
Regards



G. N. Rao.

Hyderabad, India
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: FW_OpenRecordSet lento en red
Posted: Mon Dec 18, 2023 04:04 PM

Friends:

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

Best regards

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FW_OpenRecordSet lento en red
Posted: Mon Dec 18, 2023 04:40 PM
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.
Regards



G. N. Rao.

Hyderabad, India
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: FW_OpenRecordSet lento en red
Posted: Mon Dec 18, 2023 05:42 PM

Mr. Rao:

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

Greetings

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FW_OpenRecordSet lento en red
Posted: Mon Dec 18, 2023 06:20 PM

MySql : LIMIT n

MsSql : TOP n

Regards



G. N. Rao.

Hyderabad, India
Posts: 155
Joined: Tue Dec 30, 2008 03:07 AM
Re: FW_OpenRecordSet lento en red
Posted: Mon Dec 18, 2023 06:36 PM

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.

Continue the discussion