Hello! I have two tables in an MS SQL database that I'm trying to join and display through PHP. My connection is fine and I've done it many times before, so don't worry this isn't a PHP problem. It's a my-query-won't-finish-executing problem.
Table A: (about 2 million entries)
id | lat | lon
1 | -1 | 0
2 | -5 | 1
3 | 3 | -2
etc., etc.,
Table B: (about 2,750,000 entries)
id | value
1 | 1.23
2 | 5.124
etc., etc.,
Now I really want:
id | lat | lon | value
so Ive tried a few ways of doing this, with and without joins, inner joins, all kinds of stuff. I've done something very similar with much smaller tables (about 100,000 entries) and it's worked fine. I can access either of the two tables easily, but when I want something from both the query takes forever and it doesn't finish in the 5 minutes allocated by the server.
I need the query to return much faster than over 5 minutes. (I ran a query on the server once that took many hours and still didn't finish).
So, I'm fairly new to MS SQL and most SQL in general. I'm guessing I need to index or split up the tables (even more) or maybe even remove unnecessary columns.
Anyone have any advice for this? I would really appreciate it.
Thanks!
-Ed