Find Jobs
Hire Freelancers

Optimise my MySQL query

$30-250 AUD

Ολοκληρώθηκε
Αναρτήθηκε πάνω από 5 χρόνια πριν

$30-250 AUD

Πληρωμή κατά την παράδοση
Hi there! I'm looking for an expert MySQL query writer who can optimise my query so that it runs "near-instantly". Here is my problem: - I have a table called "Map" that stores the lat/lng pairs of certain global co-ordinates. The Map table currently holds about 4,000 rows, but I expect this will grow to many millions in future. - I also have a User table that stores the ID of my users. The User table currently holds a few hundred rows, but may grow to tens of thousands (however the scale of this table is not that important for the purposes of this project). - Many rows in the Map table also assign co-ordinates to Users, so we can consider that certain locations in the Map table "belong" to certain Users. - What I want to find is for every Map row which belongs to a given user, how many Map rows that do not belong to this User are within a certain radius of each Map row. - So for example, if User "a" has 400 Map rows which belong to him, and I set the radius to 500 metres, I want to find every Map row in the Map table which DOES NOT belong to him, which is within the radius of every single Map row which DOES belong to him. This is my current query, which works successfully and is 100% accurate: SELECT Map.map_ID, [login to view URL], [login to view URL], Map.user_ID, [login to view URL], (6378137 * acos(cos(radians($lat)) * cos(radians(lat)) * cos(radians(lng) - radians($lng)) + sin(radians($lat)) * sin(radians(lat)))) AS distance FROM Map LEFT JOIN Users ON Map.user_ID = Users.user_ID WHERE Map.user_ID != 0 AND Map.user_ID != $userID HAVING distance < $distance; This individual query is basically instant on my MySQL server. The problem is that when I execute this query from PHP (using mysqli_multi_query), running the query for a user who owns 400 rows on the Map table takes 30-40 seconds to return a result. I need a near-instant result. You need to bear in mind that the query will be executed via PHP, so the solution you propose must work coming from a script (i.e. it can't work just by accessing the database directly using phpMyAdmin or equivalent). The variables $lat, $lng, $userID and $distance all come from the PHP script. Just to be 100% clear: the above query works perfectly. What I am looking for is someone to OPTIMISE my query so that it runs as fast as possible. The time I am targeting is less than 1 second for a User with 10,000 rows belonging to him, having to scan a table with 10 million rows. Your benchmark for success will be for your solution to return a result (excluding network overhead) on my server of a user with 400 rows belonging to him, having to scan a table with 4,000 rows in less than 10 milliseconds. I can supply database schemas and sample data from both tables if required. I look forward to working with you! Arj
Ταυτότητα εργασίας: 17655277

Σχετικά με την εργασία

28 προτάσεις
Απομακρυσμένη Εργασία
Ενεργός/ή 6 χρόνια πριν

Ψάχνεις τρόπο για να κερδίσεις μερικά χρήματα;

Πλεονεκτήματα πλειοδοσίας στο Freelancer

Καθόρισε τον προϋπολογισμό σου και το χρονοδιάγραμμα
Πληρώσου για τη δουλειά σου
Περίγραψε την πρόταση σου
Η εγγραφή και η πλειοδοσία σε εργασίες είναι δωρεάν
Βραβεύτηκε στον/στην:
Avatar Χρήστη
Hello, My name is Sergey. I am Freelancer from [login to view URL], Russia. I can help you as SQL expert to optimize your query. Possible way: you supply me test data, I perform my local work. When I am sure about result I will write back. I can start today. I hope to get good results today too. This is list of similar projects, successfully completed by me: 1. "Improvise internal search speed" http://www.freelancer.com/projects/takereal_9800046.html 2. "MySQL Database Optimization" http://www.freelancer.com/projects/takereal_760804.html 3. "MySQL Database Tuning" http://www.freelancer.com/projects/takereal_860810.html 4. "Analysis of reasons for slow-running SQL queries" http://www.freelancer.com/projects/takereal_613446.html 5. "mysql optimization" http://www.freelancer.com/projects/takereal_541899.html I can communicate via Freelancer.com. -- Sergey aka Takereal
$100 AUD σε 2 ημέρες
5,0 (2083 αξιολογήσεις)
8,3
8,3
28 freelancers δίνουν μια μέση προσφορά $175 AUD για αυτή τη δουλειά
Avatar Χρήστη
HI There, I can assist you Optimize MySQL query. I am very passionate about quality of my work, You will be pleased working with me. Let's have a quick chat to discuss it further. You can check my sample work at: https://www.freelancer.com/u/extreamcode.html
$155 AUD σε 3 ημέρες
5,0 (114 αξιολογήσεις)
8,0
8,0
Avatar Χρήστη
Hello there, Myself having has 10 + years experience of web site development. Expert in Custom programming in php / Mysql / Jquery / Wordpress/ Joomla / OSC / Magento /OpenCart / Android / Mobile development / Responsive. Ready to start the work immediately. I am confident to handle your projects with dedication and good quality. Thanks and regards, Harpreet Singh
$220 AUD σε 5 ημέρες
4,9 (321 αξιολογήσεις)
7,8
7,8
Avatar Χρήστη
Greetings, I used the same type of concept here and using very optimized queries...please have a look. I am an Independent Professional with 12+ years (https://www.freelancer.com/u/CodingExpertz.html) . Please give us a chance so I can prove Quality work to you. Satisfaction is 100% with money back guaranty if the work is not completed as required and within time. Feel free to inbox so I can discuss the issues in detail. Please let me know if you have any question for me. Regards, Nand
$200 AUD σε 5 ημέρες
4,8 (130 αξιολογήσεις)
6,6
6,6
Avatar Χρήστη
Hi, I have good proficiency in PHP and mysql. I can optimize the query. but, not sure till how much it will be optimized. Depends on the real time situation. you can also share the access to PHP file. so that i can check what is causing the slow down. Available to start now. Regards, Manish
$100 AUD σε 4 ημέρες
4,9 (128 αξιολογήσεις)
6,3
6,3
Avatar Χρήστη
hello i am expert in sql and ready to solved this prob in 1 day time frame kindly check my freelancer profile n lets discuss here
$250 AUD σε 1 ημέρα
5,0 (84 αξιολογήσεις)
5,9
5,9
Avatar Χρήστη
Hi, may you send me a testdb In my experience I have found that adding a n index on long, and adding a lon<lonx+r and lon >lonx-r befoore the custom diatance calculation may help much in big tables Relevant Skills and Experience mysql php
$155 AUD σε 3 ημέρες
5,0 (52 αξιολογήσεις)
5,9
5,9
Avatar Χρήστη
Hi, I worked with Php & Mysql over 15 years. I did lot of project using big data, optimized lot of queries & web sites too. To resolve your problem, we must analysis your query first, to see what indexes used. Then we need optimize table structure, add index columns...even if we need make flat table structure to get fastest speed. Also we maybe need consider using php coding to compute/compare data instead use 1 query, it maybe faster too. I can help you optimize this one. You can trust me. Please let me help you. Thanks.
$333 AUD σε 3 ημέρες
5,0 (153 αξιολογήσεις)
5,9
5,9
Avatar Χρήστη
Hi. This is Paul Devanesan has done Master's of Science in Computers with more than 1 decade designing, developing and deploying applications on Desktop and Web based for various technology stacks. I am a certified Java, PHP, Android and SQL Developer. More than 20 projects I designed and delivered Database Design for our clients. I understood your requirement pretty much clear that, existing query to rewritten and should working well. Please let me know your server credential to analyse and will proceed further on this project. I will provide best solution for your problem. Thanks Paul
$250 AUD σε 5 ημέρες
4,9 (37 αξιολογήσεις)
5,4
5,4
Avatar Χρήστη
I am MySQL DBA having more than 8 yrs of experience and I have done many projects on MySQL performance tunning
$111 AUD σε 1 ημέρα
4,7 (71 αξιολογήσεις)
5,7
5,7
Avatar Χρήστη
Hi, I have read all your description about MAP table in SQL and got all mind set how to fix your problem. Well, I have 7+ years of experience in PHP, HTML,SQL, Database Administration, Database Programming, MySQL. For relevant discussion you can take my interview at any time.I believe in a long term relationship with customers. Please initiate the chat to further discussion. Regards Vinay K
$111 AUD σε 1 ημέρα
4,6 (11 αξιολογήσεις)
4,9
4,9
Avatar Χρήστη
I can optimize your SQL query of Map Co-ordinates data, Please contact to discuss and proceed further, thanks. Relevant Skills and Experience MySQL
$155 AUD σε 3 ημέρες
3,6 (56 αξιολογήσεις)
5,5
5,5
Avatar Χρήστη
Hello, How can I check that query? I did not use functions like sin,cos,radius etc. but i think through php these function are taking time to conversion of longtitude and latitude. and exact after that there is left join used. so i have to check that what these functions are exactly doing and why we have static value 6378137 in the query? Would like to discuss further so that we can reach to the next level of discussion. Looking forward for the positive response. Thanks and Regards, Naman
$188 AUD σε 3 ημέρες
5,0 (3 αξιολογήσεις)
1,1
1,1
Avatar Χρήστη
I have 8 year's experience in MySQL, could fulfill your requirement. We can discuss about the details, and the deadline of project.
$144 AUD σε 10 ημέρες
5,0 (1 αξιολόγηση)
0,8
0,8
Avatar Χρήστη
We thePRISMSOFT IT TECHNOLOGIES primary goal is to create websites using the latest technologies and trends designed to portray the CLIENT’S aims and objectives, We hold one goal above all others: 100% client satisfaction. Our in-house team of web designers, content writers, graphic designers, developers and test engineers uphold the highest standards for project planning and execution, and we’re dedicated to building the perfect website for your company on-time and on-budget. We’ve built websites for different Client’s (Domestic & International) with great success, and are quite excited to get to work on yours. We have a dedicated Project handling team, which follows SDLC process to handle a project in right manner from analysis phase to deployment phase by using licensed versions of all software’s. Below is the strategic methodology where we use the technologies in each phase… Implementation of technologies Front-end (Design Phase): Adobe Illustrator, Photoshop (Development Phase): HTML 5, CSS 3, Java Script, Bootstrap, Angular JS, Android Back-end (Server side scripting):PHP (Database): MySQL (Web Server): Apache (Operating System): Linux, Windows Testing Manual Testing-Functional & Non functional Automation Testing-Selenium, Load Runner Technical Support &Maintenance Team:  Network administrator  Database administrator  Contact no:91-8501055511
$155 AUD σε 10 ημέρες
0,0 (0 αξιολογήσεις)
0,0
0,0
Avatar Χρήστη
Extensive experience in software industry . Deliver the solution on time. Reliable
$155 AUD σε 3 ημέρες
0,0 (0 αξιολογήσεις)
0,0
0,0
Avatar Χρήστη
Hello Arj, I have strong background in MySQL. I can help you and I'm ready to work on it until the problem will be solved. Need to see your DB schema. Looking forward tohear from you.
$88 AUD σε 1 ημέρα
0,0 (0 αξιολογήσεις)
0,0
0,0
Avatar Χρήστη
Expert in MySQL queries and optimization. having 18+ years experience in database optimization. Handled 300,00,00,000 transactions in a month
$222 AUD σε 3 ημέρες
0,0 (0 αξιολογήσεις)
0,0
0,0
Avatar Χρήστη
Hi, Welcome to GD, here I am providing C# Desktop Applications with SQL Server Integration. I have a vast experience in Development and designing. I have gone though your projects requirements and details and I am quite optimistic that I can do this job. Kindly allow me to serve you with my best of services. You can ask for any samples you want it is totally free. Feel free to ask for any query. I am available for you any time.
$222 AUD σε 3 ημέρες
0,0 (0 αξιολογήσεις)
0,0
0,0

Σχετικά με τον πελάτη

Σημαία της AUSTRALIA
Sydney, Australia
5,0
60
Επαληθευμένη μέθοδος πληρωμής
Μέλος από Μαρ 8, 2012

Επαλήθευση Πελάτη

Ευχαριστούμε! Σου έχουμε στείλει ένα email με ένα σύνδεσμο για να διεκδικήσεις τη δωρεάν πίστωση σου.
Κάτι πήγε στραβά κατά την προσπάθεια αποστολής του email σου. Παρακαλούμε δοκίμασε ξανά.
Εγγεγραμμένοι Χρήστες Συνολικές Αναρτημένες Δουλειές
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Φόρτωση προεπισκόπησης
Δόθηκε πρόσβαση για Geolocation.
Η σύνδεση σου έχει λήξει και τώρα έχεις αποσυνδεθεί. Παρακαλούμε συνδέσου ξανά.