I think this is really a sqlite question (not a spatialite question), but you may be better off if you do not to store all the projected data inside the database (bad design to duplicate data), but rather to reproject the selected set on query (i.e. use ST_Transform on the results of the query). Keep the single geometry column.
If you do need to reproject it all, a set of smaller transactions may help (say 1000-5000 rows per transaction).
A slower machine may not be much worse, although disk performance does matter. If speed is really more important than transaction safety, see https://www.sqlite.org/faq.html#q19
Brad
--
You received this message because you are subscribed to the Google Groups "SpatiaLite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spatialite-use...@googlegroups.com.
To post to this group, send email to spatiali...@googlegroups.com.
Visit this group at https://groups.google.com/group/spatialite-users.
For more options, visit https://groups.google.com/d/optout.
I think this is really a sqlite question (not a spatialite question), but you may be better off if you do not to store all the projected data inside the database (bad design to duplicate data), but rather to reproject the selected set on query (i.e. use ST_Transform on the results of the query). Keep the single geometry column.
If you do need to reproject it all, a set of smaller transactions may help (say 1000-5000 rows per transaction).
A slower machine may not be much worse, although disk performance does matter. If speed is really more important than transaction safety, see https://www.sqlite.org/faq.html#q19
You do realise that you could project your query box as well?
You can ATTACH a database, and just create a view, but you’d need to test and tune for your scenario / usage patterns.
Brad
You do realise that you could project your query box as well?
On Sun, 25 Feb 2018 13:54:17 -0800 (PST), Dave Milter wrote:
> What is the best way to update every row in column added by
> `AddGeometryColumn`?
>
here are the measured timings of some practical test.
Hi, Sandro.
On Monday, February 26, 2018 at 2:31:37 PM UTC+3, sandro furieri wrote:On Sun, 25 Feb 2018 13:54:17 -0800 (PST), Dave Milter wrote:
> What is the best way to update every row in column added by
> `AddGeometryColumn`?
>
here are the measured timings of some practical test.
Thanks for sharing numbers. I retried my measurements using this knowledge,
and CreateSpatialIndex after filling 'proj' column indeed reduce time to 2x times.
But how in practice should I use CreateSpatialIndex?
yes, it could effectively work but it requires a
further passage, because after calling DisableSpatialIndex
"geometry_columns"."spatial_index_enabled" will be
set to 0, thus causing any following call to
RecoverSpatialIndex to fail.
so the correct sequence should be:
..... DisableSpatialIndex ....;
UPDATE geometry_columns SET spatial_index_enabled = 1
WHERE f_table_name = 'house_nr_proj' AND
f_geometry_column = 'geom';
..... RecoverSpatialIndex ....;
b. repeatedly calling RecoverSpatialIndex will cause
a catastrophic slowness, because this function will
scan the whole Spatial Table checking for every
single feature if a corresponding R*Tree entry do
correctly exists.
it's a cure exacerbating the disease.
the same is for repeatedly dropping and recreating
the Spatial Index; you'll simply end up by paying
several times a cost you've already payed before.
calling CreateSpatialIndex _after_ populating the
spatial table can be an effective solution only if
you are absolutely sure to never change in a second
time the spatial table.
but if you already know in advance that the spatial
table will certainly change from time to time, then
the simpler and most effective solution you can adopt
is the one to never touch an existing R*Tree, leaving
it absolutely free to follow its own internal logic.
please, read more carefully my previous example
"test #6"; it's exactly the configuration you
are looking for.
On Mon, 26 Feb 2018 09:11:02 -0800 (PST), Dave Milter wrote:
> On Monday, February 26, 2018 at 7:34:24 PM UTC+3, sandro furieri
> wrote:
>
>> please, read more carefully my previous example
>> "test #6"; it's exactly the configuration you
>> are looking for.
>
> I reread it again. As I understand "test #6" has such architecture:
> in ":memory:" st_tranformed database with only geometry ( SRID=4326 )
> and in file the same data with SRID=3003 and may be additional data.
>
> Actually I imagine little different architecture: two spatial indexes
> for one table, one in ":memory:", one in file.
>
sorry, this is not allowed in SpatiaLite; a Spatial Index is always
expected to be in the same database where the corresponding Spatial
Table is.
> The difference is in triggers, as I see your "tables with index only"
> in ":memory:" will be not changed, if database in file was changed.
> But not big deal I can add triggers on update/insert/delete by
> myself.
>
you are absolutely free to implement any alternative of your own, but
this will clearly become a different thing from SpatiaLite.
if I understand well your intentions, the simpler solution I can
suggest you is:
- open a first connection to the permanent SpatiaLite database.
- then open a second connection to another database just intended
to store your own "unorthodox" and volatile R*Tree.
- the second DB connection does not strictly requires to support
SpatiaLite; you can directly create and fully manipulate an
R*Tree just using the basic SQLite support.
https://sqlite.org/rtree.html
- I'm obviously assuming that you are going to use some high
level language to develop your application, so dispatching
the SQL queries between the two connections shouldn't be a
serious issue.