From: | Abu Mushayeed <abumushayeed(at)yahoo(dot)com> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org |
Subject: | What is wrong ? |
Date: | 2007-02-17 00:07:56 |
Message-ID: | 952896.9977.qm@web57101.mail.re3.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
I have created a rule on a table as folows:
CREATE OR REPLACE RULE edw_item_avail_200606 AS
ON INSERT TO edw_item_avail
WHERE "substring"(new.amc_week_id::text, 1, 6) = '200606'::text DO INSTEAD INSERT INTO mpartition.edw_item_avail_200308 (item_avail_key, prod_dim_id, amc_week_id, edw_prod_dim_id, zl_store_nbr, ticketed_retail, owned_retail, qty_sales_units, qty_return_units, qty_new_rcv_units, qty_rcv_adj_units, qty_transin_units, qty_transout_units, qty_inv_adj_units, qty_rtv_in_units, qty_rtv_out_units, qty_bal_units, qty_end_stk_units, qty_begin_stk_units, create_date, zl_divn_nbr)
VALUES (new.item_avail_key, new.prod_dim_id, new.amc_week_id, new.edw_prod_dim_id, new.zl_store_nbr, new.ticketed_retail, new.owned_retail, new.qty_sales_units, new.qty_return_units, new.qty_new_rcv_units, new.qty_rcv_adj_units, new.qty_transin_units, new.qty_transout_units, new.qty_inv_adj_units, new.qty_rtv_in_units, new.qty_rtv_out_units, new.qty_bal_units, new.qty_end_stk_units, new.qty_begin_stk_units, new.create_date, new.zl_divn_nbr);
Now, when I issue the following query:
insert into edw_item_avail
select * from public."edw_item_avail_ORIG"
where substring(amc_week_id::text,1,6) = 200606::text ;
The explain is as follows:
Seq Scan on "edw_item_avail_ORIG" (cost=0.00..705569.97 rows=81321 width=107)
Filter: (("substring"((amc_week_id)::text, 1, 6) = '200606'::text) AND (("substring"((amc_week_id)::text, 1, 6) = '200606'::text) IS NOT TRUE))
Seq Scan on "edw_item_avail_ORIG" (cost=0.00..705569.97 rows=409 width=107)
Filter: (("substring"((amc_week_id)::text, 1, 6) = '200606'::text) AND ("substring"((amc_week_id)::text, 1, 6) = '200606'::text))
My problem is when I have more rules all are appended and it is taking a long time to move data from the "ORIG" table to the actually partitioned table. The partitioned table are based on substring(amc_week_id::text,1,6).
If someone can shed some light on this, it will be very helpful.
Thanks
Abu
---------------------------------
Never Miss an Email
Stay connected with Yahoo! Mail on your mobile. Get started!
From | Date | Subject | |
---|---|---|---|
Next Message | Hiroshi Saito | 2007-02-17 00:33:05 | Re: Fwd: [ADMIN] Debug (is it PostgreSQL?) |
Previous Message | Tom Lane | 2007-02-16 23:57:39 | Re: rename a cluster |