Monthly Archive: February 2011

Feb
12

Fastest way of deleting all but 1 row in a table?

I came across a situation at work today that required me to delete most of the rows in a table. The table wasn’t very large, about 200 000 rows with an average row size of 90-100. Plus indexes. Let’s say it looked something like this: CREATE TABLE order_lines( order_no NUMBER(11) NOT NULL ,order_line_no NUMBER(5) NOT …

Continue reading »