I am having some data in the session
table, which holds the user location along with some other data related to user
The session table consists of multiple columns like
- id -
PRIMARY KEY AUTO-INCREMENT
- session_id -
UNIQUE KEY
(This will be unique for every time, even if user logs in multiple times, this will be generated UNIQUE) - user_id (This user id is unique to every user)
- user_location (Holds the coordinates of the user)
Problem Statment
I wanted to know that is there any performance difference between the below two queries.
First Query
SELECT
user_location
FROM session WHEREsession_id
= 'some-session-id-goes-here';
Second Query
SELECT
user_location
FROM session WHEREsession_id
= 'some-session-id-goes-here' ANDuser_id
='usome-user-id';
Both the queries give correct data, but is there any effect on performance if suppose there is millions for data present in this session table.
Running both queries on smaller set of data < 4000
did not give any difference in fetching time
.