[fpc-pascal] FreePascal and MySQL

Michael Van Canneyt michael at freepascal.org
Sat May 2 10:10:01 CEST 2015



On Fri, 1 May 2015, Terry A. Haimann wrote:

> I was kind of unimpressed with the performance of TSqlQuery compared to
> c.

That is logical.

Beside the point raised by Jonas, 
if you use a library which is designed to be general and cross-db-engine, 
it will always be somewhat slower than code which is written specifically 
for one engine. You will most likely be using wholly different techniques.

> I wrote two programs that built the same identical table.  A random set
> of names with addresses.  I found the user time of the program written
> in c was 20% of that which was written in Free Pascal.

Without details of the program, it is difficult to say what causes this.
The use of Random may be one cause. Transaction management may be another.
Who knows what else ?

>
> Is there any chance of someone working on this library to improve
> performance?

I doubt there is a lot you can do to improve performance, but you are welcome to try.

Specifically for MySQL, there is only one thing left to do: use parameter support for mysql version>=5.0,
which should significantly improve performance. Currently (since the same code is used for versions of mysql <5.0) 
the parameters are substituted in code in the SQL.

And, as suggested by Adriaan, try to use Postgres or Firebird, which are by far better databases.

Michael.



More information about the fpc-pascal mailing list