Skip to main content
referenced comment
Source Link
amball
  • 1.5k
  • 9
  • 22

ST_Distance() or ST_DWithin() are much better in this context.

If you use ST_Buffer(), you add the expensive operation of creating a new geometry. Also, you won't be able to use a spatial index that you may have in place. The other two options avoid this.

You should get the same answer, however.

EDIT: See the important qualifier in the comments below, that the spatial index still won't be used if you are nesting a ST_Transform within ST_DWithin().

ST_Distance() or ST_DWithin() are much better in this context.

If you use ST_Buffer(), you add the expensive operation of creating a new geometry. Also, you won't be able to use a spatial index that you may have in place. The other two options avoid this.

You should get the same answer, however.

ST_Distance() or ST_DWithin() are much better in this context.

If you use ST_Buffer(), you add the expensive operation of creating a new geometry. Also, you won't be able to use a spatial index that you may have in place. The other two options avoid this.

You should get the same answer, however.

EDIT: See the important qualifier in the comments below, that the spatial index still won't be used if you are nesting a ST_Transform within ST_DWithin().

Source Link
amball
  • 1.5k
  • 9
  • 22

ST_Distance() or ST_DWithin() are much better in this context.

If you use ST_Buffer(), you add the expensive operation of creating a new geometry. Also, you won't be able to use a spatial index that you may have in place. The other two options avoid this.

You should get the same answer, however.