SKIP in tMySQL slower then in DBF?

SKIP in tMySQL slower then in DBF?

Postby Marc Vanzegbroeck » Sun Sep 30, 2012 8:44 am

Hi,

When I run this code after a query with about 500 records
Code: Select all  Expand view
     oQry:GoTop()
      DO WHILE !oQry:eof()
           oQry:Skip(1)
      ENDDO
 

it take about 0.52seconds

When I run this in a DBF-file with the same records
Code: Select all  Expand view
Go Top
      DO WHILE !eof()
           Skip
      ENDDO

it take about 0.1 seconds

Is there a faster way to read the result of a query?

Thanks
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: SKIP in tMySQL slower then in DBF?

Postby Enrico Maria Giordano » Sun Sep 30, 2012 8:55 am

I don't know what oQry is but have you tried using ADO?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8378
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: SKIP in tMySQL slower then in DBF?

Postby Marc Vanzegbroeck » Sat Oct 06, 2012 1:42 pm

Enrico Maria Giordano wrote:I don't know what oQry is but have you tried using ADO?

EMG


Enrico,

I did a test with ADO and there the skip took only 0.03 seconds instead of 0.5 in tMySQL!!!
So ADO it's much faster then tMySQL if you only skips a recordset.

Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: SKIP in tMySQL slower then in DBF?

Postby carlos vargas » Sat Oct 06, 2012 1:56 pm

depend of type of recordset, exist 3 type,
please search in google.
ones is only for skip from first to last record and is very fast.
but no update.

salu2
carlos vargas
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1691
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: SKIP in tMySQL slower then in DBF?

Postby Marc Vanzegbroeck » Sat Oct 06, 2012 2:02 pm

carlos vargas wrote:depend of type of recordset, exist 3 type,
please search in google.
ones is only for skip from first to last record and is very fast.
but no update.

salu2
carlos vargas


Carlos,

I use Option=3 in the connection-string.
The one I use skipped all records, because I also added a counter after each skip, and at the end the counter had a result of the records in the recordset.

Code: Select all  Expand view
t = 0
DO While !oQry:eof()
    oQry:movenext()
    t++
ENDDO
? t
 


Regards,
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: SKIP in tMySQL slower then in DBF?

Postby Rick Lipkin » Sat Oct 06, 2012 2:30 pm

Marc

I like ADO .. the Class and methods are standard whether you use Sql Server, Oracle, dB2 or Access.

Using ADO you can craft your recordset to cache your SQL results to the local client's memory ( which I think you mentioned in your post ) and once that fetch of records are on the client .. browses are fast and seamless .. data manipulation is very fast ..

There is more than one way to open and create a recordset .. FW has a set of functions that accomplish those tasks .. but I like to do it the ole fashioned way so I can assign my own parameters :

Code: Select all  Expand view

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


Notice the CursorLocation parameter .. Ms Sql, Oracle, Access support these parameters ..

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2634
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: SKIP in tMySQL slower then in DBF?

Postby Marc Vanzegbroeck » Sat Oct 06, 2012 2:38 pm

Rick,

Thank you for your reply.

I'm still testing the ADO-SQL-connection.
Now I use the CreateObject("ADODB.Connection") that is also on the very usefull page http://wiki.fivetechsoft.com/doku.php?id=ado-related_stuffs

I will also try the OLE-way...

Regards,
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: SKIP in tMySQL slower then in DBF?

Postby Rick Lipkin » Sat Oct 06, 2012 2:42 pm

Marc

Forgive my choice of words and humor .. 'ole fashioned' translates into "Old Fashioned" :lol: :lol:

You are on the right track and the link to the Wiki is just what I would suggest..

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2634
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: SKIP in tMySQL slower then in DBF?

Postby Marc Vanzegbroeck » Sat Oct 06, 2012 2:48 pm

Rick

I found the link from a reply from you in this topic http://forums.fivetechsupport.com/viewtopic.php?f=3&t=24957

Thanks,
Marc
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1157
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: SKIP in tMySQL slower then in DBF?

Postby Rick Lipkin » Sat Oct 06, 2012 2:54 pm

Marc

YES ..

In my opinion, the ( free ) Ms Sql Express is great for creating very robust Sql applications...

http://www.microsoft.com/en-us/download ... x?id=29062

Ms Access will do nicely as well for situations where you just need a local table .. please review AdoRick.prg in the \samples folder showing how to create, manipulate Ms Access and very fast incremental searches using Filters.

I got started using the full Enterprise version of Sql Server years ago and I never looked back... especially attractive to me was the OLEDB provider is native to every modern Windows OS.. you do not have to distribute anything .. just your executable.

Rick
User avatar
Rick Lipkin
 
Posts: 2634
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 38 guests