DELETE Performance

Tuesday, 25 August 2015 · 4 messages · last reply 14 Sep 2015
MF
Martín Ferrari25 Aug 2015 00:43 #
Hi: I have a DB with around a million records. Adding resources to it takes some milliseconds. However, executing DELETE on a resource takes more than 60 seconds. Am I doing something wrong? Is this by design? Thanks! Martín.
AH
Alexander Holupirek25 Aug 2015 09:06 #
Hi Martín, could you provide a simple, self-contained code snippet that demonstrates this behaviour? This way we could have a look. Alex
Quoted text · Martín Ferrari · 7 lines
> On 25.08.2015, at 00:43, Martín Ferrari <ferrari_martin at hotmail.com> wrote: > > Hi: > I have a DB with around a million records. Adding resources to it takes some milliseconds. However, executing DELETE on a resource takes more than 60 seconds. Am I doing something wrong? Is this by design? > > Thanks! > Martín.
MF
Martín Ferrari25 Aug 2015 17:16 #
Sure. I'm using BaseX 8.2.3 on linux, using the C# client located at https://github.com/BaseXdb/basex/blob/master/basex-api/src/main/c%23/BaseXClient.cs.The DB, as reported by the rest interface: <rest:database resources="1015172" size="10063643321">mferrari_test_6</rest:database> This is my simplified test function: static void DoSingleDeleteProcessing(string db) { int localId = 310072; BaseXClient.Session baseXClientSession = new BaseXClient.Session(server, 1984, user, password); baseXClientSession.Execute("open " + db); string filename = "prueba" + localId.ToString("D8") + ".xml"; baseXClientSession.Execute("DELETE " + filename); baseXClientSession.Close(); } This is what I get in the logs: 17:20:22.253 10.1.5.144:61340 admin REQUEST OPEN mferrari_test_6 39.83 ms17:20:22.321 10.1.5.144:61340 admin OK Database 'mferrari_test_6' was opened in 68.44 ms. 68.54 ms17:20:22.324 10.1.5.144:61340 admin REQUEST DELETE prueba00310072.xml 1.47 ms17:21:20.794 10.1.5.144:61340 admin OK 1 resource(s) deleted in 58469.92 ms. 58469.98 ms A Replace on the same DB results in the following entries: 17:24:38.070 10.1.5.144:61359 admin REQUEST OPEN mferrari_test_6 39.97 ms17:24:38.138 10.1.5.144:61359 admin OK Database 'mferrari_test_6' was opened in 67.69 ms. 67.79 ms17:24:38.170 10.1.5.144:61359 admin REQUEST REPLACE prueba00310071.xml [...] 0.34 ms17:24:38.548 10.1.5.144:61359 admin OK 0 resource(s) replaced in 377.84 ms. 377.98 ms Thanks! Martín.
Quoted text · Alexander Holupirek · 20 lines
> Subject: Re: [basex-talk] DELETE Performance > From: alex at holupirek.de > Date: Tue, 25 Aug 2015 09:06:59 +0200 > CC: basex-talk at mailman.uni-konstanz.de > To: ferrari_martin at hotmail.com > > Hi Martín, > > could you provide a simple, self-contained code snippet that demonstrates this behaviour? This way we could have a look. > > Alex > > > On 25.08.2015, at 00:43, Martín Ferrari <ferrari_martin at hotmail.com> wrote: > > > > Hi: > > I have a DB with around a million records. Adding resources to it takes some milliseconds. However, executing DELETE on a resource takes more than 60 seconds. Am I doing something wrong? Is this by design? > > > > Thanks! > > Martín. >
CG
Christian Grün14 Sep 2015 11:34 #
Hi Martín, I have done various tests on replace and delete, but in all cases, delete performed better than replace (see e.g. the attached Java example).. * Did you already find out more about the causes? * Did you encounter the same behavior without the C# client or rest? * What happens after a full database optimization? Best, Christian
Quoted text · Martín Ferrari · 77 lines
On Tue, Aug 25, 2015 at 5:16 PM, Martín Ferrari <ferrari_martin at hotmail.com> wrote: > Sure. I'm using BaseX 8.2.3 on linux, using the C# client located at > https://github.com/BaseXdb/basex/blob/master/basex-api/src/main/c%23/BaseXClient.cs. > The DB, as reported by the rest interface: > > <rest:database resources="1015172" > size="10063643321">mferrari_test_6</rest:database> > > This is my simplified test function: > > static void DoSingleDeleteProcessing(string db) > { > int localId = 310072; > > BaseXClient.Session baseXClientSession = new > BaseXClient.Session(server, 1984, user, password); > baseXClientSession.Execute("open " + db); > > string filename = "prueba" + localId.ToString("D8") + ".xml"; > baseXClientSession.Execute("DELETE " + filename); > baseXClientSession.Close(); > } > > This is what I get in the logs: > > 17:20:22.253 10.1.5.144:61340 admin REQUEST OPEN mferrari_test_6 > 39.83 ms > 17:20:22.321 10.1.5.144:61340 admin OK Database > 'mferrari_test_6' was opened in 68.44 ms. 68.54 ms > 17:20:22.324 10.1.5.144:61340 admin REQUEST DELETE > prueba00310072.xml 1.47 ms > 17:21:20.794 10.1.5.144:61340 admin OK 1 resource(s) > deleted in 58469.92 ms. 58469.98 ms > > > A Replace on the same DB results in the following entries: > > 17:24:38.070 10.1.5.144:61359 admin REQUEST OPEN mferrari_test_6 > 39.97 ms > 17:24:38.138 10.1.5.144:61359 admin OK Database > 'mferrari_test_6' was opened in 67.69 ms. 67.79 ms > 17:24:38.170 10.1.5.144:61359 admin REQUEST REPLACE > prueba00310071.xml [...] 0.34 ms > 17:24:38.548 10.1.5.144:61359 admin OK 0 resource(s) > replaced in 377.84 ms. 377.98 ms > > > > Thanks! > Martín. > >> Subject: Re: [basex-talk] DELETE Performance >> From: alex at holupirek.de >> Date: Tue, 25 Aug 2015 09:06:59 +0200 >> CC: basex-talk at mailman.uni-konstanz.de >> To: ferrari_martin at hotmail.com > >> >> Hi Martín, >> >> could you provide a simple, self-contained code snippet that demonstrates >> this behaviour? This way we could have a look. >> >> Alex >> >> > On 25.08.2015, at 00:43, Martín Ferrari <ferrari_martin at hotmail.com> >> > wrote: >> > >> > Hi: >> > I have a DB with around a million records. Adding resources to it takes >> > some milliseconds. However, executing DELETE on a resource takes more than >> > 60 seconds. Am I doing something wrong? Is this by design? >> > >> > Thanks! >> > Martín. >>

⚡Generated with XQuery