forked from mohamed20o03/Voting_system
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndexing.sql
More file actions
31 lines (21 loc) · 1.09 KB
/
Indexing.sql
File metadata and controls
31 lines (21 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
USE voting_system;
-- Create necessary indexes for performance
-- Indexes for Elections table
CREATE INDEX idx_election_status ON Elections(status);
CREATE INDEX idx_election_dates ON Elections(start_date, end_date);
-- Indexes for ElectionGroups table
CREATE INDEX idx_election_group_name ON ElectionGroups(group_name);
-- Indexes for GroupDistricts table
CREATE INDEX idx_group_districts ON GroupDistricts(group_id, district_id);
-- Indexes for Candidates table
CREATE INDEX idx_candidate_user ON Candidates(user_id);
CREATE INDEX idx_candidate_election ON Candidates(election_id);
-- Indexes for VoteDetails table
CREATE INDEX idx_vote_hashed_user ON VoteDetails(hashed_user_id);
CREATE INDEX idx_vote_group ON VoteDetails(group_id);
-- Indexes for encrypted_candidates table
CREATE INDEX idx_encrypted_candidate ON encrypted_candidates(encrypted_candidate);
-- Indexes for ElectionResultsPerGroup table
CREATE INDEX idx_results_group_candidate ON ElectionResultsPerGroup(group_id, candidate_id);
-- Indexes for ElectionResults table
CREATE INDEX idx_results_candidate ON ElectionResults(candidate_id);