I have a simple table on what is basically a completely fresh database:

create table import_test_uuid
    id   integer not null generated by default as identity primary key,
    guid uuid

I am inserting into this table 500 tuples as follows

insert into import_test_uuid(guid)
values ('c2ae5cc1-0cec-4109-84d3-8aa5731d65e3'),
       -- same thing 500 times

This is taking 700ms to execute, which to me seems way too slow. Inserts into a database running locally on my machine take < 10ms.

Executing select 1 on the Azure database takes around 50ms so I don't think its latency.

How can I diagnose this issue?

For context, this is a follow up to this question where I am experiencing extremely slow inserts on a table with geometry/JSONB columns.

The database on Azure is running on the following configuration:

Standard_B1ms (1 vCore, 2GB memory, 640 max iops)

32 GB storage, performance tier P10 (500 iops)

I tried changing to a general purpose configuration (same storage size) but it did not seem to improve performance.

  • You should use EXPLAIN (ANALYZE, BUFFERS) on the INSERT statement. Then you'd see how much of the time is spent planning the statement. Parsing and planning a large statement like that is going to be expensive. COPY would be the faster solution. Commented Apr 8 at 8:35


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.