Hello!
I am working on a GPS live tracking web page, where I will save the GPS positions from a number of users in a database. I can successfully send data to the database, but I am not sure how to design the database.
I would like to be able to store several events with several users, and each user sends several gps (positions-) points. So, I think I need three tables: events, users and points. The user must then send information about all three things every time they send their position:
latitude=xxx
&longitude=yyy
&datetime=dddttt
&user=username
&event=eventname
I think the tables must look like this:
events (eventID, eventName)
users (userID, userName, realName)
points (pointID, latitude, longitude, datetime, userID, eventID)
But then I will have to look up the eventID in the event table, and the userID in the users table, before I can write data to the points table.
Is that smart? Wouldn't it be better to use the eventname and username in the points table, so I don't have to look up userID and eventID every time I receive a point? It will make redundant data and take up more space, but is it better to make two queries before I can write the data, than it is to waste some space ?
What do you think?
I am working on a GPS live tracking web page, where I will save the GPS positions from a number of users in a database. I can successfully send data to the database, but I am not sure how to design the database.
I would like to be able to store several events with several users, and each user sends several gps (positions-) points. So, I think I need three tables: events, users and points. The user must then send information about all three things every time they send their position:
latitude=xxx
&longitude=yyy
&datetime=dddttt
&user=username
&event=eventname
I think the tables must look like this:
events (eventID, eventName)
users (userID, userName, realName)
points (pointID, latitude, longitude, datetime, userID, eventID)
But then I will have to look up the eventID in the event table, and the userID in the users table, before I can write data to the points table.
Is that smart? Wouldn't it be better to use the eventname and username in the points table, so I don't have to look up userID and eventID every time I receive a point? It will make redundant data and take up more space, but is it better to make two queries before I can write the data, than it is to waste some space ?
What do you think?
Statistics: Posted by lianergoist — Fri Jun 07, 2024 10:25 am