Table range partitioning
Returning to the dellstore2
example database used in Chapter 10, Query Optimization, consider the structure of the orders
table:
dellstore2=# \d orders;
Table "public.orders"
Column | Type | Modifiers
-------------+---------------+--------------------------------
orderid | integer | not null default nextval('orders_orderid_seq'::regclass)
orderdate | date | not null
customerid | integer |
netamount | numeric(12,2) | not null
tax | numeric(12,2) | not null
totalamount | numeric(12,2) | not null
Indexes:
"orders_pkey" PRIMARY KEY, btree (orderid)
"ix_order_custid" btree (customerid)
Foreign-key constraints:
"fk_customerid" FOREIGN KEY (customerid) REFERENCES customers(customerid) ON DELETE SET NULL
Referenced by:
TABLE "orderlines" CONSTRAINT "fk_orderid" FOREIGN KEY (orderid) REFERENCES orders(orderid) ON DELETE CASCADE
Imagine that after many years of operation...