Postgres database thread insertrecord lag

I have a postgres database, which I insert records into. A record maybe 8k-8mb in size, this works ok. However there is an obvious delay in the insert so I have put all the code in a thread with a priority of 1.

Problem is, it locks the UI up when its doing the insert, even though the insert is inside a thread? is this right is insertrecord not able to run correctly in a thread?
Anyone seen this or have a solution that does not involve running separate EXE’s as the app store does not like that if I recall.

Dave

You did set the MultiThreaded property of the DB object to true, did you?

While I haven’t testet with InsertRecord, I encountered a similar problem when using Prepared Statements for PostgreSQLDatabase. These are also blocking the whole Application when used in a Thread. See <https://xojo.com/issue/37806>

Are you using SQLDatabaseMBS? It allows you to do this:

tempSQLDatabaseMBS.SQLExecuteMT("INSERT INTO myTable (…) VALUES (…), (…)")

where the ‘…MT’ refers to it being thread and UI friendly.