Search Postgresql Archives

CLUSTER equivalent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Are the two following options equivalent?

OPTION A (ordered insert):

CREATE TABLE table1 (cluster_col TEXT, col2 INTEGER);
CREATE INDEX idx1 ON table1(cluster_col);
INSERT INTO table1 (cluster_col, col2) SELECT cluster_col, col2 FROM table1 ORDER BY cluster_col;

OPTION B (unordered insert followed by CLUSTER):

CREATE TABLE table1 (cluster_col TEXT, col2 INTEGER);
CREATE INDEX idx1 ON table1(cluster_col);
INSERT INTO table1 (cluster_col, col2) SELECT cluster_col, col2 FROM table1;
CLUSTER idx1 ON table1;

Thanks,
Kevin Murphy

P.S. On another topic, did I gather correctly from a recent thread that it would be more efficient to define the above table (if it were really only two columns) as:

create table clustered_tagged_genes (integer pmid, text mention);

i.e., with the integer field before the text field?


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
      message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux