List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:January 8 2003 4:35pm
Subject:Re: delay on executing mysql_free_result with underfetched query
View as plain text  
At 18:06 +0200 1/8/03, Vladimir Zheleznyak wrote:
>From: ikar@stripped
>To:   mysql@stripped
>Subject: delay on executing mysql_free_result with underfetched query
>Description:
>If to execute mysql_use_result on the query that returns large amount of
>records and then
>execute mysql_free_result - execution the last function take time equal to
>fetch all data to client.
>Is it possible to avoid this delay?

No. The reason this happens is due to the way that mysql_free_result()
is implemented, to avoid "commands out of sync" errors.  In the old
days, if you used mysql_use_result() and then didn't fetch all the
rows, calling mysql_free_result() released the result set on the client,
but the server still had rows left to send.  The next query would fail
with an out-of-sync error.

Now, mysql_free_result() automatically fetches and discards any yet-unfetched
rows, which avoids that problem.

It'd be nice were it possible to tell the server itself to discard the
rows, but it doesn't work that way.  Maybe you can use LIMIT to generate just
the initial part of the result, if you suspect that you're not going to
need it all.

>
>Synopsis: Delays on breaking fetch
>Originator: Vladimir Zheleznyak
>Organization:   Core Lab
>MySQL support:  none
>
>Severity: non-critical
>Priority: low
>Category: mysql client, C
>Class:  sw-bug
>Release: mysql-3.23.51
>
>Exectutable:   mysqld-nt
>Environment:   Celeron 800, RAM 256 MB, localhost
>System:        Win2000
>Compiler:      VC++ 6.0
>Architecture:  i
>
>Best regards,
>Vladimir Zheleznyak

Thread
delay on executing mysql_free_result with underfetched queryVladimir Zheleznyak8 Jan
  • Re: delay on executing mysql_free_result with underfetched queryPaul DuBois8 Jan