Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Primary Key from multiple attribute #59

Open
kryzhikh opened this issue Jun 23, 2016 · 3 comments
Open

Primary Key from multiple attribute #59

kryzhikh opened this issue Jun 23, 2016 · 3 comments

Comments

@kryzhikh
Copy link

Hello,

Is there any way to have multiple attributes as a primary key? I have an object that has 2 string attributes and combination of them determines the object uniqueness.

Thanks.

@dimazen
Copy link
Contributor

dimazen commented Jun 23, 2016

Hello, @kryzhikh! Unfortunately no. I was trying to manage stuff like that in the past but wasn't able to manage correct prefetch. Issue is in the predicate, when we have to fetch objects that has received IDs.
When key is one, then predicate is PK IN arrayOfPKs, however for multiple PKs it is hard to describe it. This should be either a very long (PK1 == A && PK2 == B) || (PK1 == A1 && PK2 == B) .... or something different. Do you have any idea, by the way?

@kryzhikh
Copy link
Author

Thanks for the quick reply! No ideas so far.. I'll let you know, if I work it out.

@dimazen
Copy link
Contributor

dimazen commented Jun 23, 2016

Well, we can go with PK1 IN firstPKArray AND PK2 IN secondPKArray. I assume, that sql does optimisation, so lookup don't have to be O(n^2). This might be an idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants