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 8815905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:29:31+00:00 2026-06-14T04:29:31+00:00

I have one table called ‘Region’ which has got 2000 records. In the region

  • 0

I have one table called ‘Region’ which has got 2000 records. In the region table I have 1 geometry column called points. Now I have another table called Bus_Route with geometry column called ‘geometry’ with 10 million records. Now I want the points which lie in that region. I am using the following query to see weather my point lies in that region or not by using STcontains. But this query is taking long time (around 3 days). I have created Spatial index on my Bus_Route table which has got 10 million records but that didn’t help as well.

         Select
              Region.BlockID,
              Bus_Route.geometry
              from 
              Bus_Route,                         
              Region
           where 

              Region.points.STContains(Bus_Route.geometry) = 1

Please help!

  • 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-06-14T04:29:32+00:00Added an answer on June 14, 2026 at 4:29 am

    A couple of observations:

    1. Because your bus probably doesn’t run through Flatland, use
      geography instead of geometry.
    2. If you’re going to do a cross join
      (which, your query as stated is doing), be explicit about it by
      doing something like:

      Select
      Region.BlockID,
      Bus_Route.geometry
      from Bus_Route
      cross join Region

    3. Have you looked at using STIntersects instead of STContains? If I’m interpreting your problem correctly, you’re looking for regions that a given route passes through, which means that the intersection between the two geo instances would be non-empty. The query you’ve written will show routes that are fully enclosed within a region.

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

Sidebar

Related Questions

I have one table, t1, which has fileds called userid, week and year fields.
Lets say I have one table called REVIEWS This table has Reviews that customers
I have 2 datatables in a dataset. One table has a list called CostTypes.
I have a table called order which has many order_items , each order_items is
I have a table called order which has many order_items , each order_items is
I have a table called 'customer' which has too many rows & the decision
I have one table called: Transaction. This table has the following fields: (ID,ProductName,Amount,Date) placed
I have a table called sellerparams with a number of columns, one of them
I have some tables. These tables all have one column in common called 'classified_id':
I have one table which contains events and dates, and another which contains the

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.