<div dir="ltr">Hello,<div><br></div><div>I have a query in which I need to find the intersection of a trajectory (tGeomPoint) with a polygon and get the sub trajectory which intersects.</div><div>So I am using </div><div><br></div><div>getTime(atvalue(tintersects(tt.trajectory_extracted_l0,b.b1),true)) </div><div><br></div><div>to get the time periods during which there is an intersection.</div><div>My dataset contains about 21 million points which form about 17000 trajectories. <br clear="all"><div>The full query is </div><div><br></div><div>WITH box(b1) AS (<br>SELECT ST_MakeEnvelope(116.390000,39.90,116.404655,39.9072,4326))<br>SELECT tt.trip_id as id,getTime(atvalue(tintersects(tt.trajectory_extracted_l0,b.b1),true)) periods<br>FROM box b, trips_trajectory tt<br>WHERE intersects(tt.trajectory_extracted_l0, b.b1);<br></div><div><br></div><div>The above query takes about 5.5 seconds to execute on my data. </div><div>I have built indexes on the trajectory as shown in the example in </div><div>documentation and the research paper. </div><div>Is it possible to modify the query so that it can run in less time?</div><div><br></div><div>Thanks in advance for your help.</div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Regards,<div>Sharath</div><div><br></div></div></div></div></div>