ST_Length3D — Returns the 3-dimensional or 2-dimensional length of the geometry if it is a linestring or multi-linestring.
float ST_Length3D(
geometry a_3dlinestring)
;
Returns the 3-dimensional or 2-dimensional length of the geometry if it is a linestring or multi-linestring. For 2-d lines it will just return the 2-d length (same as ST_Length and ST_Length2D)
This function supports 3d and will not drop the z-index.