4 ms·
I don't think that using a client side generated id is actually a real step in optimizing. Except the case you block all writes to the db.
by alexpopescu 14y ago
I don't think that using a client side generated id is actually a real step in optimizing. Except the case you block all writes to the db.
- wiredfool 14y agoWhat I wound up doing in a case like this was dump (using copy) into a temp table, then run a sql function on the data. That way, you get it done in as few round trips as possible, essentially 3 statements (create temp table, copy, select dostuff()). The database is real fast about doing what it needs to do when you give it one big block of stuff to work with. And, if you've got a serial column, you're going go have a primary key/uniqueness constraint on it. Retrying that when it fails at interesting times is going to cost far more time and brain cells than letting the db do it.
- mrgoldenbrown 14y agoI think it is interesting to have it in there for academic purposes, to see how fast you could go sticking with the high level ORM API. Once he drops down into the expression language, he goes back to generating the ids server side.