Resort (reorder) table data

Posted by Dave Jarvis on Stack Overflow See other posts from Stack Overflow or by Dave Jarvis
Published on 2010-05-26T22:51:22Z Indexed on 2010/05/26 23:01 UTC
Read the original article Hit count: 221

Filed under:

What is the fastest way to reorder (resort) a table? In MySQL, you can do:

CREATE TABLE table2 LIKE table1;

INSERT INTO table2
  SELECT * FROM table1 ORDER BY by name;

DROP TABLE table1;

RENAME TABLE table2 TO table1;

What about PostgreSQL?

Is there a faster way?

© Stack Overflow or respective owner

Related posts about postgresql