Fastest access to a value from a dataset

Question about the fastest / most efficient access to a value from a dataset

I have some table in my database.
There are several fields in it:
id - autoincrementing

This table is rarely edited, but it is used very often.

Therefore, I write it to the memory dataset tag and while working refer to the tag. This comes out much faster than through the database.

Requests for a dataset very often are “get the value of the fieldX from the line with the given id”

The obvious option is to read the entire dataset for each request in the script, run through it to find the required id and get the required field.

I just thought that it would be possible to create a UDT without variables, but with built-in parameters field1, field2, … And for each line, create an implementation of this UDT and put everything in some folder. So I could perform such single requests via one direct

Is this a good way?
Will I win in speed?
Would the presence of additional tags slow down something else?

I have ~30 such tables
columns ~20
lines ~500-2000

Thanks in advance.