vertica optimization

DELETE_VECTORS

Data model:

1. Normalize your table

2. Use a verified compression format

Table Design:

1. Use partitions

2. Define primary key and foreign key

3. The default number type length may be larger than the actual need. For example: NUMBERC The default length of this type is 38 bits. If the actual length is smaller than this, it is best to add a suitable length when you create a table.

4. For a True/False value, the Boolean type is faster than the char(1) type and the integer type.

Projections

1. Segmentation vs. Replication (unsegmented) Simply put, use Segmentation if the amount of data is large, and use unsegmented if it is small

2. Using order by, the ideal order by fields should all appear in the where query clause (see another article [] for details)

3. For the specification of the column length, do not blindly define the large length. If the field in the filter condition and join is of character type, it is best to use the int type.

4. GROUP BY: When using group by, be sure to explain the execution plan. If you use [GROUP BY HASH] in the execution plan, you need to modify your query sql or projection at this time, group by is best to use [GROUP BY PIPELINE] ] This way uses less memory and queries faster!

5. Clear unnecessary projections, redundant projections mean that the query takes more time to select.

6. The order field in Projection first selects the filtered field, and then selects the column used by join.

7. Ensure that Projection data is evenly distributed on each node to avoid data skew during query.

Inquire:

1. Avoid using in

2. Avoid using union

3. Avoid using * when selecting, and select the appropriate column when querying

4. Use the with clause

5. Avoid using aliases, such as groupby 1,2,3

6. Use orderby in subqueries

7. Avoid using inequality relations, such as: >=, not in, etc.

8. For complex SQL, you can use more temporary tables

9. Try to clear the data in delete_vectors

Resources

1. PROFILE, view the memory required for the query

2. Establish a dedicated resource pool

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326757301&siteId=291194637