123 lines
9.5 KiB
Plaintext
123 lines
9.5 KiB
Plaintext
|
SET client_min_messages = warning;
|
||
|
--
|
||
|
-- create table.
|
||
|
--
|
||
|
CREATE TABLE tbl_cluster (
|
||
|
col1 int,
|
||
|
col2 timestamp,
|
||
|
":-)" text,
|
||
|
primary key(":-)", col1)
|
||
|
) WITH (fillfactor = 70);
|
||
|
CREATE INDEX cidx_cluster ON tbl_cluster (col2, length(":-)"));
|
||
|
ALTER TABLE tbl_cluster CLUSTER ON cidx_cluster;
|
||
|
CREATE TABLE tbl_only_pkey (
|
||
|
col1 int PRIMARY KEY,
|
||
|
":-)" text
|
||
|
);
|
||
|
CREATE TABLE tbl_only_ckey (
|
||
|
col1 int,
|
||
|
col2 timestamp,
|
||
|
":-)" text
|
||
|
) WITH (fillfactor = 70);
|
||
|
CREATE INDEX cidx_only_ckey ON tbl_only_ckey (col2, ":-)");
|
||
|
ALTER TABLE tbl_only_ckey CLUSTER ON cidx_only_ckey;
|
||
|
CREATE TABLE tbl_gistkey (
|
||
|
id integer PRIMARY KEY,
|
||
|
c circle
|
||
|
);
|
||
|
CREATE INDEX cidx_circle ON tbl_gistkey USING gist (c);
|
||
|
ALTER TABLE tbl_gistkey CLUSTER ON cidx_circle;
|
||
|
INSERT INTO tbl_cluster VALUES(1, '2008-12-31 10:00:00', 'admin');
|
||
|
INSERT INTO tbl_cluster VALUES(2, '2008-01-01 00:00:00', 'king');
|
||
|
INSERT INTO tbl_cluster VALUES(3, '2008-03-04 12:00:00', 'joker');
|
||
|
INSERT INTO tbl_cluster VALUES(4, '2008-03-05 15:00:00', 'queen');
|
||
|
INSERT INTO tbl_cluster VALUES(5, '2008-01-01 00:30:00', sqrt(2::numeric(1000,999))::text || sqrt(3::numeric(1000,999))::text);
|
||
|
--
|
||
|
-- do reorg
|
||
|
--
|
||
|
\! pg_reorg --dbname=contrib_regression --table=tbl_cluster
|
||
|
--
|
||
|
-- results
|
||
|
--
|
||
|
\d+ tbl_cluster
|
||
|
Table "public.tbl_cluster"
|
||
|
Column | Type | Modifiers | Storage | Description
|
||
|
--------+-----------------------------+-----------+----------+-------------
|
||
|
col1 | integer | not null | plain |
|
||
|
col2 | timestamp without time zone | | plain |
|
||
|
:-) | text | not null | extended |
|
||
|
Indexes:
|
||
|
"tbl_cluster_pkey" PRIMARY KEY, btree (":-)", col1)
|
||
|
"cidx_cluster" btree (col2, length(":-)")) CLUSTER
|
||
|
Has OIDs: no
|
||
|
Options: fillfactor=70
|
||
|
|
||
|
\d+ tbl_gistkey
|
||
|
Table "public.tbl_gistkey"
|
||
|
Column | Type | Modifiers | Storage | Description
|
||
|
--------+---------+-----------+---------+-------------
|
||
|
id | integer | not null | plain |
|
||
|
c | circle | | plain |
|
||
|
Indexes:
|
||
|
"tbl_gistkey_pkey" PRIMARY KEY, btree (id)
|
||
|
"cidx_circle" gist (c) CLUSTER
|
||
|
Has OIDs: no
|
||
|
|
||
|
\d+ tbl_only_ckey
|
||
|
Table "public.tbl_only_ckey"
|
||
|
Column | Type | Modifiers | Storage | Description
|
||
|
--------+-----------------------------+-----------+----------+-------------
|
||
|
col1 | integer | | plain |
|
||
|
col2 | timestamp without time zone | | plain |
|
||
|
:-) | text | | extended |
|
||
|
Indexes:
|
||
|
"cidx_only_ckey" btree (col2, ":-)") CLUSTER
|
||
|
Has OIDs: no
|
||
|
Options: fillfactor=70
|
||
|
|
||
|
\d+ tbl_only_pkey
|
||
|
Table "public.tbl_only_pkey"
|
||
|
Column | Type | Modifiers | Storage | Description
|
||
|
--------+---------+-----------+----------+-------------
|
||
|
col1 | integer | not null | plain |
|
||
|
:-) | text | | extended |
|
||
|
Indexes:
|
||
|
"tbl_only_pkey_pkey" PRIMARY KEY, btree (col1)
|
||
|
Has OIDs: no
|
||
|
|
||
|
SET synchronize_seqscans = off;
|
||
|
SELECT col1, to_char(col2, 'YYYY-MM-DD HH24:MI:SS'), ":-)" FROM tbl_cluster;
|
||
|
col1 | to_char | :-)
|
||
|
------+---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||
|
2 | 2008-01-01 00:00:00 | king
|
||
|
5 | 2008-01-01 00:30:00 | 1.4142135623730950488016887242096980785696718753769480731766797379907324784621070388503875343276415727350138462309122970249248360558507372126441214970999358314132226659275055927557999505011527820605714701095599716059702745345968620147285174186408891986095523292304843087143214508397626036279952514079896872533965463318088296406206152583523950547457502877599617298355752203375318570113543746034084988471603868999706990048150305440277903164542478230684929369186215805784631115966687130130156185689872372352885092648612494977154218334204285686060146824720771435854874155657069677653720226485447015858801620758474922657226002085584466521458398893944370926591800311388246468157082630100594858704003186480342194897278290641045072636881313739855256117322040245091227700226941127573627280495738108967504018369868368450725799364729060762996941380475654823728997180326802474420629269124859052181004459842150591120249441341728531478105803603371077309182869314710171111683916581726889419758716582152128229518488471.732050807568877293527446341505872366942805253810380628055806979451933016908800037081146186757248575675626141415406703029969945094998952478811655512094373648528093231902305582067974820101084674923265015312343266903322886650672254668921837971227047131660367861588019049986537379859389467650347506576050756618348129606100947602187190325083145829523959832997789824508288714463832917347224163984587855397667958063818353666110843173780894378316102088305524901670023520711144288695990956365797087168498072899493296484283020786408603988738697537582317317831395992983007838702877053913369563312103707264019249106768231199288375641141422016742752102372994270831059898459475987664288897796147837958390228854852903576033852808064381972344661059689722872865264153822664698420021195484155278441181286534507035191650016689294415480846071277143999762926834629577438361895110127148638746976545982451788550975379013880664961911962222957110555242923723192197738262561631468842032853716682938649611917049738836395495938
|
||
|
3 | 2008-03-04 12:00:00 | joker
|
||
|
4 | 2008-03-05 15:00:00 | queen
|
||
|
1 | 2008-12-31 10:00:00 | admin
|
||
|
(5 rows)
|
||
|
|
||
|
SELECT * FROM tbl_gistkey;
|
||
|
id | c
|
||
|
----+---
|
||
|
(0 rows)
|
||
|
|
||
|
SELECT * FROM tbl_only_ckey;
|
||
|
col1 | col2 | :-)
|
||
|
------+------+-----
|
||
|
(0 rows)
|
||
|
|
||
|
SELECT * FROM tbl_only_pkey;
|
||
|
col1 | :-)
|
||
|
------+-----
|
||
|
(0 rows)
|
||
|
|
||
|
RESET synchronize_seqscans;
|
||
|
--
|
||
|
-- clean up
|
||
|
--
|
||
|
DROP TABLE tbl_cluster;
|
||
|
DROP TABLE tbl_gistkey;
|
||
|
DROP TABLE tbl_only_pkey;
|
||
|
DROP TABLE tbl_only_ckey;
|
||
|
RESET client_min_messages;
|