Vertical partitioning of a table

In the use of vertical partitioning, we split a table with many columns into multiple tables with particular columns. For example, we must not define very wide text or binary large object (BLOB) data columns infrequently queried tables because of performance issues. This data must be placed in a separate table structure, and a pointer can be used in queried tables.

What follows is a simple example of how we can use vertical partitioning on a customer table and move a binary data type column, customer_Imageinto a separate table:

CREATE TABLE customer
(
customer_ID numeric(10,0) NOT NULL,
accountName character varying(60) NOT NULL,
accountNumber numeric(10,0) NOT NULL,
customer_Image bytea
);

Partition data vertically, as follows:

CREATE TABLE customer
(
customer_Id numeric(10,0) NOT NULL,
accountName character varying(60) NOT NULL,
accountNumber numeric(10,0) NOT NULL
);

CREATE TABLE customer_Image
(
customer_Image_ID numeric(10,0) NOT NULL,
customer_Id numeric(10,0) NOT NULL,
customer_Image bytea
);

In JPA/Hibernate, we can easily map the previous example with a lazy one-to-many relationship between the tables. The data usages of the customer_Image table are not frequent, so we can set it as lazily loaded. Its data is retrieved when a client requests the specific columns of the relationship.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset