Re: [sqlite] Query optimization: Checking for existence before performing action

2013-08-03 Thread James K. Lowden
On Mon, 29 Jul 2013 13:23:07 +0100 Simon Slavin wrote: > INSERT OR IGNORE a new row with the correct 'word' and a confidence > of 0 > UPDATE the row with that word to increment the confidence. ... > If that solution doesn't work for you you might like to try first > doing

Re: [sqlite] Query optimization: Checking for existence before performing action

2013-08-02 Thread Simon Slavin
On 2 Aug 2013, at 2:09pm, Igor Tandetnik wrote: > On 8/2/2013 8:14 AM, Simon Slavin wrote: >> >> On 2 Aug 2013, at 10:13am, Jan Slodicka wrote: >> >>> Hi Simon, >>> >>> the solution might look elegant, but it is probably a lot slower. I did not >>> check

Re: [sqlite] Query optimization: Checking for existence before performing action

2013-08-02 Thread Igor Tandetnik
On 8/2/2013 8:14 AM, Simon Slavin wrote: On 2 Aug 2013, at 10:13am, Jan Slodicka wrote: Hi Simon, the solution might look elegant, but it is probably a lot slower. I did not check this particular case, but in the past I found triggers to perform rather badly. I am puzzled.

Re: [sqlite] Query optimization: Checking for existence before performing action

2013-08-02 Thread Simon Slavin
On 2 Aug 2013, at 10:13am, Jan Slodicka wrote: > Hi Simon, > > the solution might look elegant, but it is probably a lot slower. I did not > check this particular case, but in the past I found triggers to perform > rather badly. I am puzzled. My solution does not involve any

Re: [sqlite] Query optimization: Checking for existence before performing action

2013-08-02 Thread Jan Slodicka
Hi Simon, the solution might look elegant, but it is probably a lot slower. I did not check this particular case, but in the past I found triggers to perform rather badly. Regards, Jan -- View this message in context:

Re: [sqlite] Query optimization: Checking for existence before performing action

2013-07-29 Thread Keith Medcalf
te-users- > boun...@sqlite.org] On Behalf Of Navaneeth.K.N > Sent: Monday, 29 July, 2013 05:58 > To: General Discussion of SQLite Database > Subject: [sqlite] Query optimization: Checking for existence before > performing action > > Hello, > > I am trying to optimize the SQ

Re: [sqlite] Query optimization: Checking for existence before performing action

2013-07-29 Thread Simon Davies
On 29 July 2013 12:57, Navaneeth.K.N wrote: > Hello, > > I am trying to optimize the SQL calls that my application makes. I > have a scenario where words are inserted into a table. Now each word > will have a column called "confidence". There is a unique primary key > on

Re: [sqlite] Query optimization: Checking for existence before performing action

2013-07-29 Thread Simon Slavin
On 29 Jul 2013, at 12:57pm, Navaneeth.K.N wrote: > When inserting a word, first I check if the words exists by performing > a "select" query. If it exists, I fire an update query to increment > the confidence for that word. If word is not available, I fire an > insert

[sqlite] Query optimization: Checking for existence before performing action

2013-07-29 Thread Navaneeth.K.N
Hello, I am trying to optimize the SQL calls that my application makes. I have a scenario where words are inserted into a table. Now each word will have a column called "confidence". There is a unique primary key on "word". When inserting a word, first I check if the words exists by performing a