<div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">That does look like a pretty huge bounding polygon, but the geography we<br>
agree should still be using the spatial index, so probably making the index<br>
cost higher than it should<br></blockquote><div><br></div><div>Fyi the border values are are simply composed of a regular 20km grid of ajoining polygon squares covering Australia (about 1.3M tiles).  Incidentally, with the border of tiles being square, the bounding box *is* the shape I guess.  It's not relevant, but the query returns a count 95 of these 20km tiles.</div>
<div><br></div><div>We're dealing with satellite data - the datasets themselves have far bigger coverages (different table entirely), but this is why you've noticed the "region of interest" in the query is large.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Nick,<br>
<br>
Can you just for contrast, try to force it to use the index by doing<br>
<br>
set enable_seqscan = off;<br>
<br>
 explain analyze select count(*) from wastac.t_tile_geometry where<br>
ST_Intersects(border, ST_GeographyFromText('SRID=4326;POLYGON((116.751709<br>
<div class="im">-31.381779,116.883545 -32.676373,114.741211 -32.796510,114.796143<br>
-31.316101,116.751709 -31.381779))'));<br></div></blockquote><div><br></div><div>Strange - no difference.</div><div><br></div><div><div>wastac=> set enable_seqscan = off;</div><div>SET</div><div>wastac=> explain analyze select count(*) from wastac.t_tile_geometry where ST_Intersects(border, ST_GeographyFromText('SRID=4326;POLYGON((116.751709 -31.381779,116.883545 -32.676373,114.741211 -32.796510,114.796143-31.316101,116.751709 -31.381779))'));</div>
<div>                                                                                                                       QUERY PLAN                                                                                                               </div>
<div>--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</div>
<div> Aggregate  (cost=10000364056.80..10000364056.81 rows=1 width=0) (actual time=8909.585..8909.586 rows=1 loops=1)</div><div>   ->  Seq Scan on t_tile_geometry  (cost=10000000000.00..10000362993.14 rows=425463 width=0) (actual time=2028.827..8909.533 rows=95 loops=1)</div>
<div>         Filter: st_intersects(border, '0103000020E61000000100000005000000F8C610001C305D40B24CBF44BC613FC0D6E253008C385D40DE72F563935640C0DF1B430070AF5C40EE77280AF46540C01EFCC401F4B25C409F3BC1FEEB503FC0F8C610001C305D40B24CBF44BC613FC0'::geography)</div>
<div> Total runtime: 8909.626 ms</div><div>(4 rows)</div><div><br></div></div><div> </div></div>