OK. That makes sense. I will just delete the file. It also has the benefit of making the code simpler and avoiding using memory.
On Wed, Sep 4, 2019 at 5:25 AM Rob Willett <rob.sql...@robertwillett.com> wrote: > Peng, > > Dropping very large tables is time consuming. Dropping a 59GB table > takes quite a long time for us even on fast hardware. Dropping smaller > tables is faster though. > > Not sure what size tables you have but something to think about. We > experimented with new tables and changing old tables and for us, > dropping the table and creating a new one was the fastest method but > still took 40-60 mins from memory. > > Rob > > On 4 Sep 2019, at 11:18, Peng Yu wrote: > > > For now, I just delete the db file if it exists already. So that I > > don’t > > need to call DROP TABLE IF EXISTS mytab. I guess directly deleting the > > db > > file can be faster than the latter. Is it so? > > > > On Tue, Sep 3, 2019 at 3:06 PM Simon Slavin <slav...@bigfraud.org> > > wrote: > > > >> On 3 Sep 2019, at 8:57pm, Peng Yu <pengyu...@gmail.com> wrote: > >> > >>> If I try to create a table that already exists, sqlite will give me > >>> an > >> error. Is there way to issue one command to create a table, but if > >> there is > >> already a table with the same name, drop it then create the new > >> table? > >> Thanks. > >> > >> Assuming that the new table has a different structure to the old one, > >> do > >> it in two commands: > >> > >> DROP TABLE IF EXISTS MyTable; > >> CREATE TABLE MyTable ...; > >> > >> Neither of those commands will generate an error. > >> > >> If you are sure that the new table has the same structure as the old > >> one, > >> you can do > >> > >> CREATE TABLE IF NOT EXISTS MyTable ...; > >> DELETE FROM MyTable; > >> _______________________________________________ > >> sqlite-users mailing list > >> sqlite-users@mailinglists.sqlite.org > >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > >> > > -- > > Regards, > > Peng > > _______________________________________________ > > sqlite-users mailing list > > sqlite-users@mailinglists.sqlite.org > > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > -- Regards, Peng _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users