Index a Table on User ID

Hey, there :wave:

My question regards the use of indexes to improve the speed of data retrieval.

We are building an application where users aggregate their banking transactions.

Our schema connects a table User (one) to a table Transaction (many).

To improve the speed of the data query, we would like to index the Transaction table on User ID.

However, unless I am mistaken, at the moment, we cannot index a table of the ID of another table.

To solve the problem, my first instinct would be to create a userId field on the Transaction table and perform the indexing on this new field.

Is this the right approach to the problem?

Would you have another solution to propose?

Thanks :v:

Hello @andreasblondeau!
Yes, your approach works just fine. Our developers have suggested the same.
I responded to your ticket at the service desk too. Hope it will solve your problem.