devxlogo

Insert Performance

Insert Performance

Question:
When I try to do a simple insert in a table with 25,000 records, it takes a long time do execute. In the same database for a table with 2,000 records, it’s immediate.

Why is this?

Answer:
Does that table have an index or two on it?

Are there any locks being thrown before you get done, such as from people doing select on it?

Try to break your insert down into smaller groups and commit them as you go. I think this will lighten the overhead you’re incurring.

See also  Comparing different methods of testing your Infrastructure-as-Code
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist