简体   繁体   中英

how to break mapping table in order to faster query result and database size

I have employee number table and one group mapping table.

desc employee_tab;
----------------
empno int;
emp_name varchar(50);

desc group_mapping_tab;
------------------------
empno int;
group_no int;

i have 10 lac records in employee table, when i create groups of employee data insert into group mapping table like (empno1, group_no1).. (empno2,group_no1).....(empno100000,group_no1). the group is create corresponding empno goes in mapping table.n number of emp can can in n group. In group mapping table increasing very fast when new groups are creating. plz suggest how to breaks or recreate group mapping table. now data in group mapping table reach to 60 lac and increasing very fast.

SELECT mxn_distributor.MemberID,mxn_distributor.NationalID
FROM mxn_distributor
INNER JOIN(
    SELECT NationalID
    FROM mxn_distributor
    GROUP BY NationalID
    HAVING COUNT(NationalID) >1
)temp ON mxn_distributor.NationalID= temp.NationalID ORDER BY NationalID ASC;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM