Support Questions

Find answers, ask questions, and share your expertise

Phoenix INDEX Column Sort in DESC Order

I have created an INDEX on my tables using below DDL:

CREATE INDEX my_index ON my_table (col1, col2, col3 , EVENT DESC) INCLUDE (col4 , col5);

However the EVENT column is not sorted in descending order. Is there anything I am missing? Have I created the Index correctly?

One thing I wanted to highlight was my EVENT column datatype is VARCHAR....is that making EVENT column not to sort?

1 REPLY 1

bq. One thing I wanted to highlight was my EVENT column datatype is VARCHAR....is that making EVENT column not to sort?

Varchar field is also expected to be sorted in desc as like for other data types.

Your "desc" declaration for Event column will be visible only when there are records having the same value for col1,col2,col3.

you can order your keys as per your query pattern or create an additional index with a new order.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.