[GRASS-dev] [GRASS GIS] #2587: copying attribute tables very inefficient if tables are in same database

GRASS GIS trac at osgeo.org
Wed Feb 11 10:18:31 PST 2015


#2587: copying attribute tables very inefficient if tables are in same database
------------------------------+---------------------------------------------
 Reporter:  mlennert          |       Owner:  grass-dev@…              
     Type:  enhancement       |      Status:  new                      
 Priority:  normal            |   Milestone:  7.1.0                    
Component:  Database          |     Version:  svn-trunk                
 Keywords:  libdb copy table  |    Platform:  Unspecified              
      Cpu:  Unspecified       |  
------------------------------+---------------------------------------------
 The function copy_table in lib/db/dbmi_client/copy_tab.c seems very
 inefficient to me when both the old and the new table are in the same
 database and it is a database with real SQL functionalities. IIUC, the
 function actually selects all rows from the input table into a cursor and
 the inserts them, row by row, into the output table. With a large table
 this takes a long time.

 Using a simple "CREATE TABLE new_table AS SELECT [*, ListOfColumns] FROM
 old_table WHERE [Conditions]" is much faster !

 So, it would be a great addition if for the relevant drivers, such as
 SQLite and PostgreSQL, could use this approach.

 P.S. There is no LibDB component in the tracker. Don't know if there
 should be...

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/2587>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list