[GRASS-dev] Speeding up v.out.ogr (again)

Markus Metz markus.metz.giswork at googlemail.com
Thu Mar 1 11:41:34 EST 2012


On Wed, Feb 29, 2012 at 8:23 AM, Benjamin Ducke <benducke at fastmail.fm> wrote:
> Dear Devs,
>
> A while ago, I submitted a small patch for v.out.ogr
> that moves the SQL SELECT out of the mk_att() function,
> so that this costly operation does not have to be
> performed multiple times:
>
> http://lists.osgeo.org/pipermail/grass-dev/2011-January/053150.html
>
> Looking at 6.4.2 and 6.5 SVN copies of v.out.ogr,
> I see that SQL SELECT is still (again?) in mk_att(), with
> this comment (line 1053):
>
>  /* Fetch all attribute records for cat <cat> */
>  /* opening and closing the cursor is slow,
>   * but the cursor really needs to be opened for each cat separately */
>
> Is this because of GRASS maps that have more than one
> attribute table connection?

No, this is because the i-th feature does not need to have category i,
it can have any category and multiple categories. Selecting all
attributes at once for all categories is also not memory-safe for
larger vectors.

>
> If so, then I suggest putting in a condition, so that those
> GRASS maps that have just one attribute table can perform
> the SQL SELECT outside of mk_att(). Otherwise, we punish
> all GRASS users with extremely slow export speed, even though
> most of them might not even use multi-table attributes in
> their projects. The difference in my test was something like
> factor 500!

Please test if attribute assignment is preserved and attributes are
not randomly swapped. A stream vector created with r.stream.extract
would be a good test case.

Markus M


More information about the grass-dev mailing list