Page 1 of 1

Delphi XE8 - MS Access / PostgreSQL

Posted: Wed 07 Apr 2021 08:05
by AlainANTOCI
Hi,

I use Delphi XE8. I have an old application working with Delphi XE8 and DBMS was MS Access 97 to 2003 working with ADO (TADOQuery). The new version of the application will be with Unidac an postgreSQL, I've finish the transfert but I don't notice a lot of increase speed in some operation. For example I import data from xml file and put them into differents tables :
1) ReadXml
2) Data to temporary tables less faster than ADO, I use :
TUniQuery.Sql.Text := 'SELECT * FROM MyTable WHERE (0 = 1)'
TUniQuery.Open;
TUniQuery.Insert;
TUniQuery.FieldByName('MyField').As.... := Value
....
TUniQuery.Post;

I try do write 'INSERT INTO ....' instead, same result.

Can I do it in a different way, I have to insert 20000 value, it take 8 minutes ?

Regards

Re: Delphi XE8 - MS Access / PostgreSQL

Posted: Wed 07 Apr 2021 11:07
by FCS
Hello,

Try open transaction before data importing and commit it at the end.

Regards
M.

Re: Delphi XE8 - MS Access / PostgreSQL

Posted: Fri 14 May 2021 06:39
by evgeniym
Hi,
As alternative you may use following methods:
1. Form a multi-line SQL query and execute it at once.
2. Form a query with parameters and perform preparation using Prepare, and then, in a loop, assign values with paraments and add data using Execute.
3. Use batch update mechanism. You can find more information about batch updates in our PgDAC documentation:
https://www.devart.com/pgdac/docs/batchops.htm
Or in our blog:
https://blog.devart.com/using-batch-ope ... nents.html

Best regards,
Evgeniy

Re: Delphi XE8 - MS Access / PostgreSQL

Posted: Mon 14 Jun 2021 11:33
by AlainANTOCI
Thanks batch was the solution.

Re: Delphi XE8 - MS Access / PostgreSQL

Posted: Tue 15 Jun 2021 09:36
by evgeniym
Hi Alain,
I’m glad that your issue is resolved and you can use all features of the software.
Please feel free to contact us anytime in case you have any other questions.

Best regards,
Evgeniy