create_index.sql 2.6 KB
Newer Older
M
Marc G. Fournier 已提交
1
--
2 3
-- CREATE_INDEX
-- Create ancillary data structures (i.e. indices)
M
Marc G. Fournier 已提交
4 5 6 7 8 9 10 11 12 13 14
--

--
-- BTREE
--
CREATE INDEX onek_unique1 ON onek USING btree(unique1 int4_ops);

CREATE INDEX onek_unique2 ON onek USING btree(unique2 int4_ops);

CREATE INDEX onek_hundred ON onek USING btree(hundred int4_ops);

15
CREATE INDEX onek_stringu1 ON onek USING btree(stringu1 name_ops);
M
Marc G. Fournier 已提交
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

CREATE INDEX tenk1_unique1 ON tenk1 USING btree(unique1 int4_ops);

CREATE INDEX tenk1_unique2 ON tenk1 USING btree(unique2 int4_ops);

CREATE INDEX tenk1_hundred ON tenk1 USING btree(hundred int4_ops);

CREATE INDEX tenk2_unique1 ON tenk2 USING btree(unique1 int4_ops);

CREATE INDEX tenk2_unique2 ON tenk2 USING btree(unique2 int4_ops);

CREATE INDEX tenk2_hundred ON tenk2 USING btree(hundred int4_ops);

CREATE INDEX rix ON road USING btree (name text_ops);

CREATE INDEX iix ON ihighway USING btree (name text_ops);

CREATE INDEX six ON shighway USING btree (name text_ops);

--
-- BTREE ascending/descending cases
--
-- we load int4/text from pure descending data (each key is a new
39
-- low key) and name/f8 from pure ascending data (each key is a new
M
Marc G. Fournier 已提交
40 41 42 43 44
-- high key).  we had a bug where new low keys would sometimes be
-- "lost".
--
CREATE INDEX bt_i4_index ON bt_i4_heap USING btree (seqno int4_ops);

45
CREATE INDEX bt_name_index ON bt_name_heap USING btree (seqno name_ops);
M
Marc G. Fournier 已提交
46 47 48 49 50 51 52

CREATE INDEX bt_txt_index ON bt_txt_heap USING btree (seqno text_ops);

CREATE INDEX bt_f8_index ON bt_f8_heap USING btree (seqno float8_ops);

--
-- BTREE partial indices
53
-- partial indices are not supported in PostgreSQL
M
Marc G. Fournier 已提交
54 55 56 57 58 59 60 61 62 63 64
--
--CREATE INDEX onek2_u1_prtl ON onek2 USING btree(unique1 int4_ops)
--	where onek2.unique1 < 20 or onek2.unique1 > 980;

--CREATE INDEX onek2_u2_prtl ON onek2 USING btree(unique2 int4_ops)
--	where onek2.stringu1 < 'B';

-- EXTEND INDEX onek2_u2_prtl where onek2.stringu1 < 'C';

-- EXTEND INDEX onek2_u2_prtl;

65
-- CREATE INDEX onek2_stu1_prtl ON onek2 USING btree(stringu1 name_ops)
M
Marc G. Fournier 已提交
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
--	where onek2.stringu1 >= 'J' and onek2.stringu1 < 'K';

--
-- RTREE
-- 
-- rtrees use a quadratic page-splitting algorithm that takes a
-- really, really long time.  we don't test all rtree opclasses
-- in the regression test (we check them USING the sequoia 2000
-- benchmark).
--
CREATE INDEX rect2ind ON fast_emp4000 USING rtree (home_base bigbox_ops);


--
-- HASH
--
CREATE INDEX hash_i4_index ON hash_i4_heap USING hash (random int4_ops);

84
CREATE INDEX hash_name_index ON hash_name_heap USING hash (random name_ops);
M
Marc G. Fournier 已提交
85 86 87 88 89 90 91

CREATE INDEX hash_txt_index ON hash_txt_heap USING hash (random text_ops);

CREATE INDEX hash_f8_index ON hash_f8_heap USING hash (random float8_ops);

-- CREATE INDEX hash_ovfl_index ON hash_ovfl_heap USING hash (x int4_ops);