Database optimization for x,y coordinates
up vote
0
down vote
favorite
Let's say I have a database structure with columns x, y, backgroundID, itemID.
Imagine I have 100 millions lines where backgroundID has always a value, but itemID has a value only for 10000 lines.
There will be a lot of range requests (x < ? AND x > ? AND y < ? AND y > X), a lot of exact line request (x = ? and y = ?) and really few insertions.
What is the best way to index the database ? Index on x, index on y, index on both x and y ?
And now, what if I need to request often the lines where itemID is not null (let's say only 10 000 lines). Is it better to create a second separate table that store only x, y and itemID ?
Update to answer Mehdi El Fadil : I'm not still fixed on wich RDBMS I will use, I was thinking of a simple MySQL Workbench 6.3, InnoDB for exemple.
database performance indexing
add a comment |
up vote
0
down vote
favorite
Let's say I have a database structure with columns x, y, backgroundID, itemID.
Imagine I have 100 millions lines where backgroundID has always a value, but itemID has a value only for 10000 lines.
There will be a lot of range requests (x < ? AND x > ? AND y < ? AND y > X), a lot of exact line request (x = ? and y = ?) and really few insertions.
What is the best way to index the database ? Index on x, index on y, index on both x and y ?
And now, what if I need to request often the lines where itemID is not null (let's say only 10 000 lines). Is it better to create a second separate table that store only x, y and itemID ?
Update to answer Mehdi El Fadil : I'm not still fixed on wich RDBMS I will use, I was thinking of a simple MySQL Workbench 6.3, InnoDB for exemple.
database performance indexing
Hi Silvère, could you update the question and add which RDBMS and version you are using? depending on these, specific solutions may be found (e.g. partitioning)
– Mehdi
Nov 8 at 12:02
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Let's say I have a database structure with columns x, y, backgroundID, itemID.
Imagine I have 100 millions lines where backgroundID has always a value, but itemID has a value only for 10000 lines.
There will be a lot of range requests (x < ? AND x > ? AND y < ? AND y > X), a lot of exact line request (x = ? and y = ?) and really few insertions.
What is the best way to index the database ? Index on x, index on y, index on both x and y ?
And now, what if I need to request often the lines where itemID is not null (let's say only 10 000 lines). Is it better to create a second separate table that store only x, y and itemID ?
Update to answer Mehdi El Fadil : I'm not still fixed on wich RDBMS I will use, I was thinking of a simple MySQL Workbench 6.3, InnoDB for exemple.
database performance indexing
Let's say I have a database structure with columns x, y, backgroundID, itemID.
Imagine I have 100 millions lines where backgroundID has always a value, but itemID has a value only for 10000 lines.
There will be a lot of range requests (x < ? AND x > ? AND y < ? AND y > X), a lot of exact line request (x = ? and y = ?) and really few insertions.
What is the best way to index the database ? Index on x, index on y, index on both x and y ?
And now, what if I need to request often the lines where itemID is not null (let's say only 10 000 lines). Is it better to create a second separate table that store only x, y and itemID ?
Update to answer Mehdi El Fadil : I'm not still fixed on wich RDBMS I will use, I was thinking of a simple MySQL Workbench 6.3, InnoDB for exemple.
database performance indexing
database performance indexing
edited Nov 8 at 13:08
asked Nov 8 at 11:25
Silvère
12
12
Hi Silvère, could you update the question and add which RDBMS and version you are using? depending on these, specific solutions may be found (e.g. partitioning)
– Mehdi
Nov 8 at 12:02
add a comment |
Hi Silvère, could you update the question and add which RDBMS and version you are using? depending on these, specific solutions may be found (e.g. partitioning)
– Mehdi
Nov 8 at 12:02
Hi Silvère, could you update the question and add which RDBMS and version you are using? depending on these, specific solutions may be found (e.g. partitioning)
– Mehdi
Nov 8 at 12:02
Hi Silvère, could you update the question and add which RDBMS and version you are using? depending on these, specific solutions may be found (e.g. partitioning)
– Mehdi
Nov 8 at 12:02
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206786%2fdatabase-optimization-for-x-y-coordinates%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Hi Silvère, could you update the question and add which RDBMS and version you are using? depending on these, specific solutions may be found (e.g. partitioning)
– Mehdi
Nov 8 at 12:02