issues
search
RyoMiyashita
/
42HoursTuning2023
42 Tokyoで開催するイベント管理
MIT License
0
stars
0
forks
source link
indexが必要なところの調査
#7
Open
zd-zhang
opened
1 year ago
zd-zhang
commented
1 year ago
必要なところ
match-groups
sql
SELECT
FROM skill WHERE EXISTS (SELECT
FROM skill WHERE skill_name = ?)
SELECT match_group_id, match_group_name, description, status, created_by, created_at FROM match_group WHERE match_group_id = ? AND status = 'open'
index
skill: key (skill_name)
match_group: key (match_group_id , status)
session
sql
SELECT * FROM session WHERE linked_user_id = ?
index
session: key (linked_user_id)
users
sql
SELECT user_id FROM user WHERE mail = ? AND password = ?
SELECT user_id, user_name, office_id, user_icon_id FROM user ORDER BY entry_date ASC, kana ASC LIMIT ? OFFSET ?
SELECT department_id FROM department WHERE department_name LIKE ? AND active = true
SELECT user_id FROM department_role_member WHERE department_id IN (?) AND belong = true
SELECT role_id FROM role WHERE role_name LIKE ? AND active = true
SELECT user_id FROM department_role_member WHERE role_id IN (?) AND belong = true
SELECT office_id FROM office WHERE office_name LIKE ?
SELECT user_id FROM user WHERE office_id IN (?)
SELECT skill_id FROM skill WHERE skill_name LIKE ?
SELECT department_name FROM department WHERE department_id = (SELECT department_id FROM department_role_member WHERE user_id = ? AND belong = true)
index
user: key (mail, password)
user: key (entry_date, kana)
user: key (office_id)
department: key (department_name, active)
department_role_member: key (department_id, belong)
department_role_member: key (role_id, belong)
department_role_member: key (user_id, belong)
role: key (role_name, active)
office: key (office_name)
skill: key (skill_name)
まとめ
user: key (mail, password)
user: key (entry_date, kana)
user: key (office_id)
department: key (department_name, active)
department_role_member: key (department_id, belong)
department_role_member: key (role_id, belong)
department_role_member: key (user_id, belong)
role: key (role_name, active)
office: key (office_name)
skill: key (skill_name)
match_group: key (match_group_id , status)
session: key (linked_user_id)
課題
getUsersByKeywordの時色々なfieldが条件なので、全部indexを作成すると大変です。
必要なところ
match-groups
sql
index
session
sql
index
users
sql
index
まとめ
課題
getUsersByKeywordの時色々なfieldが条件なので、全部indexを作成すると大変です。