Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 783B22E2FFF for ; Fri, 14 Mar 2008 14:17:16 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 25753-01-2 for ; Fri, 14 Mar 2008 14:17:04 -0300 (ADT) X-Greylist: delayed 00:31:18.445535 by SQLgrey-1.7.5 Received: from ns2.instrumentalyst.com (blk-222-55-203.eastlink.ca [24.222.55.203]) by postgresql.org (Postfix) with ESMTP id 062F52E1E2F for ; Fri, 14 Mar 2008 14:17:05 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ns2.instrumentalyst.com (Postfix) with ESMTP id BAB19415 for ; Fri, 14 Mar 2008 12:44:46 -0400 (AST) X-Virus-Scanned: amavisd-new at instrumentalyst.com Received: from ns2.instrumentalyst.com ([127.0.0.1]) by localhost (ns2.instrumentalyst.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HzE7kU5Kg57x for ; Fri, 14 Mar 2008 12:44:30 -0400 (AST) Received: from Arjuna.local (rrcs-24-129-176-158.se.biz.rr.com [24.129.176.158]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ns2.instrumentalyst.com (Postfix) with ESMTP id 76C39106 for ; Fri, 14 Mar 2008 12:44:30 -0400 (AST) Message-ID: <47DAABA8.60402@productivitymedia.com> Date: Fri, 14 Mar 2008 12:45:28 -0400 From: PostgreSQL Admin User-Agent: Thunderbird 2.0.0.12 (Macintosh/20080213) MIME-Version: 1.0 To: PostgreSQL SQL List Subject: DB Design Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.413 tagged_above=0 required=5 tests=AWL=0.413 X-Spam-Level: X-Archive-Number: 200803/86 X-Sequence-Number: 30414 I have a inventory system design in which I would like some help with to see if it's efficient. The products are broken into: Product tables Property tables Configurable Products - this would include colors (i.e. - black, blue and green) tied to products I'm thinking of breaking inventory into 2 tables. Product Inventory Inventory Adjustment Should I include the fk of the Configurable Product in the above tables or break it out further into more tables? Product Inventory Inventory Adjustment --plus-- Product Property Inventory Inventory Property Adjustment Thanks for any input, J These are my Product tables: \d cart_product Table "public.cart_product" Column | Type | Modifiers -------------------+--------------------------+----------------------------------------------------------- id | integer | not null default nextval('cart_product_id_seq'::regclass) name | character varying(128) | not null kind | character varying(40) | sku | character varying(15) | short_description | character varying(255) | not null description | text | category_id | integer | not null date_created | timestamp with time zone | not null active | boolean | not null in_stock | boolean | not null featured | boolean | not null ordering | integer | Indexes: "cart_product_pkey" PRIMARY KEY, btree (id) "cart_product_category_id" btree (category_id) Foreign-key constraints: "cart_product_category_id_fkey" FOREIGN KEY (category_id) REFERENCES cart_category(id) DEFERRABLE INITIALLY DEFERRED \d cart_propertyvariation Table "public.cart_propertyvariation" Column | Type | Modifiers ---------------+-----------------------+--------------------------------------------------------------------- id | integer | not null default nextval('cart_propertyvariation_id_seq'::regclass) properties_id | integer | not null name | character varying(42) | not null value | character varying(20) | not null order | integer | Indexes: "cart_propertyvariation_pkey" PRIMARY KEY, btree (id) "cart_propertyvariation_properties_id" btree (properties_id) Check constraints: "cart_propertyvariation_order_check" CHECK ("order" >= 0) Foreign-key constraints: "properties_id_refs_id_73bc0a59" FOREIGN KEY (properties_id) REFERENCES cart_property(id) DEFERRABLE INITIALLY DEFERRED \d cart_configurableproduct Table "public.cart_configurableproduct" Column | Type | Modifiers -----------------+--------------+----------------------------------------------------------------------- id | integer | not null default nextval('cart_configurableproduct_id_seq'::regclass) product_id | integer | not null variation_id | integer | not null price_change | numeric(8,2) | weight_change | integer | quantity_change | integer | active | boolean | not null Indexes: "cart_configurableproduct_pkey" PRIMARY KEY, btree (id) "cart_configurableproduct_product_id" btree (product_id) "cart_configurableproduct_variation_id" btree (variation_id) Foreign-key constraints: "cart_configurableproduct_product_id_fkey" FOREIGN KEY (product_id) REFERENCES cart_product(id) DEFERRABLE INITIALLY DEFERRED "cart_configurableproduct_variation_id_fkey" FOREIGN KEY (variation_id) REFERENCES cart_propertyvariation(id) DEFERRABLE INITIALLY DEFERRED