Greetings, I have discovered that UPDATEs in PostgreSQL of the following structure
UPDATE mytable SET mycolumn=# where id=# uses Sequential scans (try EXPLAIN, you get Seq Scan) when id is an indexed primary key (bigint) generated by a sequence. It is very slow for large tables. (To do the UPDATE in Torque, I was just taking the old object, oldRow, and doing oldRow.setmycolumn(newValue); oldRow.save(); ) To get an Index Scan, it turns out you must enclose the ID number in single quotes in your query, like this: UPDATE mytable SET mycolumn=# where id='#' Are any of the Torque developers aware of this bug/feature? Torque is clearly using the sequential scan (it was taking me about 5 seconds to update a single row in a 3,000,000 row table, just like when I didn't use quotes.) Any feedback on this would be much appreciated. Thanks, Patryk Senior Programmer SUPERnatural tools, Inc.
signature.asc
Description: This is a digitally signed message part
