Hacker News new | past | comments | ask | show | jobs | submit login

That's what I expect, but for these very simple batch insert queries, it's hard to guess which takes longer.



A very simple statement may not be as simple as it looks to execute.

The table here is unconstrained (from the article "CREATE TABLE integers (value INTEGER);") but suppose that table had a primary key and a foreign key – a simple insertion of a single value into such a table would look trivial but consider what the query plan would look like as it verifies the PK and FK aren't violated. And maybe there are a couple of indexes to be updated as well. And a check constraint or three. Suddenly a simple INSERT of a literal value becomes quite involved under the skin.

(edit: and you can add possible triggers on the table)


Right, but in this particular example, the table is just

  CREATE TABLE integers (value INTEGER);


I said exactly that.


My bad, missed the first part.


Happen, happen, we've all done it. NP




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: