sql - Complexity in querying for data of two tables with a 'many to many relationship' creates time delay -
i have 'many many relationship' between 2 tables in database. 1 called "tools" other "groups". problem when want, example, tool names associated collection of groups, , return user in order present in list or something, action takes couple of seconds, , creates bad user experience. ideas of how can reduce time takes data fetched?
my linq:
var tools = new hashset<string>(); //the groups user associated foreach (var usergroup in usergroups) { //all groups in database foreach (var group in context.groups) { if(group.groupname == usergroup) group.tools.foreach(t=>{ tools.add(t.toolname); }); } } return tools;
Comments
Post a Comment