What are Decomposable Columns?

Decomposable columns are those that can be divided. They indicate a lack of normalization in the physical data model.

Using a non-decomposable column for data retrieval does not negatively impact performance.

If the column is being utilized for data access, it should be broken down into multiple columns. Each column can then be used independently for indexed access. This approach will lead to improved performance as there will be a reduction in full table scans.

If a decomposable column generates NUSI columns, the options for NUSI bit mapping are expanded.

Here is an example:

— Select all Private Gold Products being sold by our company

SELECT * FROM Transaction WHERE ProductCode LIKE ‘PRIVGOLD%’;

— Select all Private Products being sold by our company

SELECT * FROM Transaction WHERE ProductCode LIKE ‘PRIV%’;

In either scenario, accessing the data requires scanning the entire table.

Decomposing the ProductCode column allows the Optimizer to utilize existing NUSIs.

CREATE INDEX COLUMN(ProductSegment) ON Transaction;
CREATE INDEX COLUMN(ProductLevel) ON Transaction;
SELECT * FROM Transaction WHERE ProductSegment = 'PRIV' AND ProductLevel = 'Gold';

Sometimes altering the physical data model is unfeasible, necessitating the discovery of alternatives to circumvent the adverse consequences of decomposable columns. A straightforward yet effective approach is as follows:


SELECT p.ProductDescription,t.ProductCode
FROM
Transaction t
INNER JOIN
Product p
ON
t.ProductCode = p.ProductCode
WHERE
p.ProductCode LIKE '%Gold%'
;

The Product table serves as a lookup for all unique ProductCodes. The Optimizer will likely execute a full table scan on the Product table and then perform a merge join with the Transaction table. Since the Product table is of small size, the cost of a full table scan is insignificant.

Ideally, it is best to avoid using decomposable columns as a first option.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

You might also like

>