Table Partitioning and Rules
| От | Girish Bajaj |
|---|---|
| Тема | Table Partitioning and Rules |
| Дата | |
| Msg-id | 002f01c34c87$a72f59a0$7764a8c0@tietronix.com обсуждение исходный текст |
| Ответы |
Re: Table Partitioning and Rules
|
| Список | pgsql-sql |
<div class="Section1"><p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:
12.0pt">Hello All,</span></font><p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:
12.0pt"> </span></font><p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:
12.0pt">I have a set of tables partitioned horizontally. DML below. </span></font><p class="MsoNormal"><font
face="TimesNew Roman" size="3"><span style="font-size:
12.0pt"> </span></font><p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:
12.0pt">Essentially Im trying to store a persons information in a table in the database. Since we could have millions
ofpeople, with duplicates! Ive decided we need to partition the table into segments where all people with the LastName
startingfrom A to G will be in one table. H-N will be in another table and O-Z in the third. Ive created a VIEW that
doesa </span></font>UNION on all the tables.<p class="MsoNormal"><font face="Times New Roman" size="3"><span
style="font-size:
12.0pt"><br /> Now, Im trying to create an INSERT and UPDATE RULE on the VIEW that would direct an insert or update
intothe appropriate partition table depending on the person LastName. <br /><br /> I cant seem to figure this out. Does
anyoneknow how to do this?</span></font><p class="MsoNormal"><font face="Times New Roman" size="3"><span
style="font-size:
12.0pt"> </span></font><p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size:
12.0pt">Thanks,<br /> Girish<br /><br /><br /> -- Table: public."contact_A_G"<br /> CREATE TABLE public."contact_A_G"
(<br/> "CONTACTID" int8 NOT NULL,<br /> "LastName" varchar(50),<br /> "FirstName" varchar(50),<br /> CONSTRAINT
"contact_A_G_pkey"PRIMARY KEY ("CONTACTID")<br /> ) WITH OIDS;<br /><br /> -- Table: public."contact_H_N"<br /> CREATE
TABLEpublic."contact_H_N" (<br /> "CONTACTID" int8 NOT NULL,<br /> "LastName" varchar(50),<br /> "FirstName"
varchar(50),<br/> CONSTRAINT "contact_H_N_pkey" PRIMARY KEY ("CONTACTID")<br /> ) WITH OIDS;<br /><br /> -- Table:
public."contact_O_Z"<br/> CREATE TABLE public."contact_O_Z" (<br /> "CONTACTID" int8 NOT NULL,<br /> "LastName"
varchar(50),<br/> "FirstName" varchar(50),<br /> CONSTRAINT "contact_O_Z_pkey" PRIMARY KEY ("CONTACTID")<br /> )
WITHOIDS;<br /><br /><br /> CREATE VIEW </span></font>Contact AS<br /> SELECT * FROM "Contact_A_G"<br /> UNION<br />
SELECT* FROM "Contact_H_M"<br /> UNION<br /> SELECT * FROM "Contact_N_Z";<br /><br /></div>
В списке pgsql-sql по дате отправления: