Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5841671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:55:11+00:00 2026-05-22T11:55:11+00:00

The website I have to manage is a search engine for worker (yellow page

  • 0

The website I have to manage is a search engine for worker (yellow page style)

I have created a database like this:

People: <---- 4,000,000 records
id
name
address
id_activity <--- linked to the activites table
tel
fax
id_region <--- linked to the regions table

activites: <---- 1500 activites
id
name_activity

regions: <--- 95 regions
id
region_name

locations: <---- 4,000,000 records
id_people
lat
lon

So basically the request that I am having slow problem with is to select all the “workers” around a selecty city (select by the user)

The request I have created is fully working but takes 5-6 seconds to return results…

Basically I do a select on the table locations to select all the city in a certain radius and then join to the people table

  SELECT people.*,id, lat, lng, poi,  
         (6371 * acos(cos(radians(plat)) * cos(radians(lat)) * cos(radians(lng) - radians(plon)) + sin(radians(plat)) * sin(radians(lat)))) AS distance 
    FROM locations,
         people 
   WHERE locations.id = people.id 
  HAVING distance < dist 
ORDER BY distance LIMIT 0 , 20; 

My questions are:

  1. Is my Database nicely designed? I don’t know if it’s a good idea to have 2 table with 4,000,000 records each. Is it OK to do a select on it?
  2. Is my request badly designed?
  3. How can I speed up the search?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:55:11+00:00Added an answer on May 22, 2026 at 11:55 am
    1. The design looks normalized. This is what I would expect to see in most well designed databases. The amount of data in the tables is important, but secondary. However if there is a 1-to-1 correlation between People and Locations, as appears from your query, I would say the tables should be one table. This will certainly help.

    2. Your SQL looks OK, though adding constraints to reduce the number of rows involved would help.

    3. You need to index your tables. This is what will normally help most with slowness (as most developers don’t consider database indexes at all).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp.net-mvc website and people manage a list of projects. Based on
I use subversion to manage my yii website (php framework) and have separate backend
i have website of application which sells applications online.on the home page i want
I have a website where drupal manage the contents, but another application handle the
Actually I have one website in c:/wamp/www path. But now I want to manage
I have been using a php sql system to manage images on my website.
I have created a website in Visual Studio 2010 (File -> New Web Site),
I have a very basic two-page website: the home page, and an about page.
I have built a multilingual website with CodeIgniter using this library: http://codeigniter.com/wiki/URI_Language_Identifier/ I use
how can i manage in django multiple domains? Our website will be configured like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.