From: | Timu <timu(at)cetech(dot)biz> |
---|---|
To: | pgsql-tr-genel(at)postgresql(dot)org |
Subject: | Table partititon hakkında soru |
Date: | 2007-10-04 15:19:50 |
Message-ID: | 200710041819.53256.timu@cetech.biz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-tr-genel |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Merhaba,
Performans açısından bir tabloyu ilişkide bulunduğu bir tabloya göre
partititonlara ayırıyorum, partititonlara ayrılmış olan tablo üzerinde delete
insert, select işlemleri oldukça başarılı ancak şöyle bir durum ile karşı
karşıya kaldım, partition tablolarda bulunan check constraintler'in
kullandığı fieldler üzerinde update işlemi gerçekleştiremiyorum. Bu sorunu
nasıl aşabilirim?
daha iyi anlaşılması açısından aşağıda örnek yapıyı veriyorum.
# \d
public | test | table | root
public | test_1 | table | root
public | test_2 | table | root
public | test_3 | table | root
public | test_id_seq | sequence | root
manager=# \d test
Table "public.test"
Column | Type | Modifiers
- --------+---------+---------------------------------------------------
id | bigint | not null default nextval('test_id_seq'::regclass)
i | integer | not null
Rules:
test_1_rule AS
ON INSERT TO test
WHERE new.i = 1 DO INSTEAD INSERT INTO test_1 (id, i)
VALUES (new.id, new.i)
test_2_rule AS
ON INSERT TO test
WHERE new.i = 2 DO INSTEAD INSERT INTO test_2 (id, i)
VALUES (new.id, new.i)
test_3_rule AS
ON INSERT TO test
WHERE new.i = 3 DO INSTEAD INSERT INTO test_3 (id, i)
VALUES (new.id, new.i)
manager=# \d test_1
Table "public.test_1"
Column | Type | Modifiers
- --------+---------+---------------------------------------------------
id | bigint | not null default nextval('test_id_seq'::regclass)
i | integer | not null
Check constraints:
"test_1_i_check" CHECK (i = 1)
Inherits: test
manager=# \d test_2
Table "public.test_2"
Column | Type | Modifiers
- --------+---------+---------------------------------------------------
id | bigint | not null default nextval('test_id_seq'::regclass)
i | integer | not null
Check constraints:
"test_2_i_check" CHECK (i = 2)
Inherits: test
manager=# update test set i=2 where id=2;
UPDATE 1
manager=# update test set i=1 where id=2;
ERROR: new row for relation "test_2" violates check
constraint "test_2_i_check"
manager=#
- --
Timu EREN <timu(at)cetech(dot)biz>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFHBQSZcubzCFA5PLsRAkEzAJ9iDm3yerwXX0VkiZ2tZd+tCXzlFgCgvp/2
9QS1zCro9mfBjQCf4EDHjTA=
=L/GK
-----END PGP SIGNATURE-----
From | Date | Subject | |
---|---|---|---|
Next Message | Devrim GÜNDÜZ | 2007-10-04 15:25:07 | Re: Table partititon hakkında soru |
Previous Message | Timu | 2007-10-02 09:55:09 | Re: Table partition ve daha iyi anlamak.... |