Problem with TMyQuery and fetchAll=false on a large table

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jokli
Posts: 1
Joined: Tue 27 Jun 2017 14:16

Problem with TMyQuery and fetchAll=false on a large table

Post by jokli » Tue 27 Jun 2017 14:43

Hi,

I'm using a TMyQuery component with a query on a large table (~1 billion records), but I want to retrieve only the first few. Of course I could use a limit=10 clause, but I have several reasons for doing the job with the fetchAll property.
Opening the query works fine, but depending on the settings of Options.CreateConnection, the attempt to close the query results in strange behavior:

CreateConnection=true
I get an error message "Lost connection to MySql Server", which I can ignore. Ok, not nice, but works somehow.

CreateConnection=false
It seems that the component tries to retrieve all missing records before closing. So I would have to wait quite a long time, if I don't run into memory problems. So this is not an option.

The above description applies when I connect directly to the database. But our database resides on a Galera cluster. When I connect through MaxScale, the behavior is different:

CreateConnection=false
Same behavior like accessing the node directly. Found no workaround.

CreateConnection=true
I get an error message "#HY000Unknown thread id: 3243". After this, the application hangs, even if I put the MyQuery1.Close directive into a try...except block.

So working with the Galera cluster and MaxScale, I have no chance to use fetchAll=false. But fetchAll=true is not an option either.

Any idea?

Kind Regards
Joachim

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Problem with TMyQuery and fetchAll=false on a large table

Post by ViktorV » Fri 30 Jun 2017 14:34

Unfortunately, we could not reproduce the problem.
In order to get a detailed answer, please compose a small sample demonstrating the issue with test access to your server and send it to us using the contact form https://www.devart.com/company/contactform.html

Post Reply