Note that there are some explanatory texts on larger screens.

plurals
  1. PONATURAL JOIN on large tables
    primarykey
    data
    text
    <p>I am performing a simple natural join on two big tables. </p> <ul> <li>polygons contains 68,000 rows (45 MB)</li> <li>roadshydro contains about 2 million rows(210 MB) .</li> </ul> <p>Does that mean that the database engine makes a data set of 68,000*2 million rows while performing natural join internally? If so, then the amount of memory required must be 45*210 MB which is much larger than what my system has, which is only 1.5 GB. </p> <p>When I executed this Query, after 5 minutes my system crashes (abrupty shuts down). Can't it handle 250 MB of data on the database? What good for are databases then?</p> <pre><code>"I am modifying the above Question to clear the doubts of readers. 29-02-2012 today." </code></pre> <p>It seems many of my friends got confused because i mention 'natural join' word in the Question above. The real spatial Query i was using is :</p> <pre><code>select p.OID , r.OID from poygons as p , roadshydro as r Where st_intersects(p.the_geom , r.the_geom) ; </code></pre> <p>where polygons &amp; roadshydro tables each has two fields : OID , the_geom . Clearly , it is a cross product of two tables and not Natural Join on some common key.</p> <p>I monitor the main memory consumption When i execute the above query. It happens nothing. There is not a slightest amount of memory consumption , neither i get any output ever but CPU usage is almost 100%. It seems database isnt doing any computation at all. However , if i remove the where clause from the query , the Main memory consumption gradually goes too high (after 5-6 minutes ) resulting into system crash and machine abruptly shut down. This is what i am experiencing. What so special about removing the where clause? why postgres is failing to execute the query !! Surprised at this behaviour.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload