Home > database >  DB2 database optimization
DB2 database optimization

Time:11-06

Such as A table has aUserid bUserid, cUserid field, but when I don't want to show the id must be, must join the User table to obtain the UserName, I know you can join the User table three times, but is there more simple and efficient way? Don't must N field associated User table I will join it N


Select
Auserid, auserdes=(select userdes the from user b where a.a userid=b.u ser),
Buserid, buserdes=(select userdes the from user b where a. auserid=b.u ser),
Cuserid, cuserdes=(select userdes the from user b where a.c auserid=b.u ser),
The from the userlist a


As the SQL in a large amount of data, and execution efficiency of the field more time will slow down (nearly 20000 data query for nearly an hour), how to do optimization
  •  Tags:  
  • DB2
  • Related