Skip to content

Clarification about indexes with prisma relaiton mode #18687

Closed Answered by nurul3101
smashboy asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @smashboy 👋

Does the order of the fields in the index attribute matter

The order in which you pass the column names in the @relation attribute would be the same for creating the underlying composite index. The order of columns determines which types of queries can use the index efficiently.

Ideally, the first column in the index should have high selectivity i.e. if the first column has a large number of unique values relative to the total number of rows in the table, then it will help narrow down the search more efficiently, leading to better query performance.

Why vscode does not complain about second relation?

Do you get the warning for the second relation? Also, if you can sh…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by smashboy
Comment options

You must be logged in to vote
3 replies
@nurul3101
Comment options

@smashboy
Comment options

@nurul3101
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants