Re: [sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-04 Thread Simon Slavin
On 4 Sep 2019, at 11:36pm, Peng Yu wrote: > Is there a minimal work example (in software way but not hardware > failure way) to make these extra files stick around upon closing a > sqlite3 session so that I can have a proper test case to make sure I > always delete them? Perform an INSERT

Re: [sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-04 Thread Keith Medcalf
On Wednesday, 4 September, 2019 16:36, Peng Yu wrote: >> Nope. If there was a problem in closing down they can hang around (which >> is their whole point for recovery). Also if a journal mode of "persit" was >> used. But mostly from incorrect closure. >> So check for any -journal, -wal, or -shm

Re: [sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-04 Thread Peng Yu
> Nope. If there was a problem in closing down they can hang around (which is > their whole point for recovery). Also if a journal mode of "persit" was > used. But mostly from incorrect closure. > > So check for any -journal, -wal, or -shm files of the same name if you want > to obliterate a

Re: [sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-04 Thread Keith Medcalf
On Wednesday, 4 September, 2019 11:22, Peng Yu wrote: >> If you delete the database file then make sure you also delete any other >> files that might have been associated with it, such as left over journals >> and so forth. >I never see those extra files in practice. Are they guaranteed to be

Re: [sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-04 Thread David Raymond
> If you delete the database file then make sure you also delete any other > files that might have been associated with it, such as left over journals > and so forth. I never see those extra files in practice. Are they guaranteed to be deleted automatically once an SQLite session is finished?

Re: [sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-04 Thread Peng Yu
> If you delete the database file then make sure you also delete any other > files that might have been associated with it, such as left over journals > and so forth. I never see those extra files in practice. Are they guaranteed to be deleted automatically once an SQLite session is finished? --

Re: [sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-04 Thread Rob Willett
Ingo, I can't answer that as we have everything in one file. I suspect that in hindsight, putting a large table in a separate file would have been advantageous. However the one of cost of dropping a 59GB table has gone and our daily pruning and vacuuming of the table is a few seconds.

Re: [sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-04 Thread ingo
On 4-9-2019 12:24, Rob Willett 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. > When using (and dropping) this big tables, would it be of advantage to put

Re: [sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-04 Thread Keith Medcalf
>OK. That makes sense. I will just delete the file. It also has the benefit >of making the code simpler and avoiding using memory. If you delete the database file then make sure you also delete any other files that might have been associated with it, such as left over journals and so forth. --

Re: [sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-04 Thread Simon Slavin
On 4 Sep 2019, at 11:18am, 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? The answer will change depending on your hardware

Re: [sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-04 Thread Peng Yu
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 wrote: > Peng, > > Dropping very large tables is time consuming. Dropping a 59GB table > takes quite a long time for us

Re: [sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-04 Thread Rob Willett
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

Re: [sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-04 Thread Peng Yu
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 wrote: > On 3 Sep 2019, at 8:57pm, Peng Yu wrote: > > >

Re: [sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-03 Thread Simon Slavin
On 3 Sep 2019, at 8:57pm, Peng Yu 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

[sqlite] How to create a new table or overwrite an existing table in one command?

2019-09-03 Thread Peng Yu
Hi, 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. -- Regards, Peng ___