groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Price <danprice...@gmail.com>
Subject Re: Groovy Script withBatch() Hang?
Date Mon, 13 Jul 2015 20:56:36 GMT
Thanks, Owen, I'll try and provide more info:

My list format is: [[a,b,c,d], [e,f,g,h], [i,j,k,l], ...]

My stored procedure String (sp) is: 'insert into myDB.dbo.myTable (column0,
column1, column2, column3) values (?, ?, ?, ?)'

My query is:
 db.withBatch(25000, spString)  { ps ->
    list.each{
       ps.addBatch(it)
    }
    ps.executeBatch()
 }

That help at all?

Thanks,
D

On Mon, Jul 13, 2015 at 4:31 PM, Owen Rubel <orubel@gmail.com> wrote:

> Honestly without seeing the stored procedure or the query, this could be a
> variety of things.
>
> A bit of DB advice:
>
> Always use small queries to get data back and work with that data; this
> frees up threads and processes for others processes and keeps things moving.
>
> Also, query on indexes and try only to queery keys (ie primary/foreign) or
> index integers for fastest response.
>
> If using NOSQL, move keys to RDBMS for querying and data to NOSQL; this
> allows for fast querying on indexes in RDBMS and fast read/writes in NOSQL.
>
> Hope this helps.
>
>
> Owen Rubel
> 415-971-0976
> orubel@gmail.com
>
> On Mon, Jul 13, 2015 at 1:16 PM, Daniel Price <danprice303@gmail.com>
> wrote:
>
>> This is my relevant code:
>>
>>  db.withBatch(25000, spString)  { ps ->
>>     list.each{
>>        ps.addBatch(it)
>>     }
>>     ps.executeBatch()
>>  }
>>
>> list contains variables used to compose stored procedure
>>
>> Thanks!
>>
>> On Mon, Jul 13, 2015 at 4:07 PM, Owen Rubel <orubel@gmail.com> wrote:
>>
>>> wouldn't be able to help without showing some code.
>>>
>>> Owen Rubel
>>> 415-971-0976
>>> orubel@gmail.com
>>>
>>> On Mon, Jul 13, 2015 at 1:06 PM, Daniel Price <danprice303@gmail.com>
>>> wrote:
>>>
>>>> Good Afternoon,
>>>>
>>>>      I'm experiencing infrequent (1/20) hangs with a Groovy script that
>>>> uses withBatch() to insert and update a SQL Server DB using stored
>>>> procedures.  In each case (insert or update), the batch completes as
>>>> indicated by database content, but the script hangs and does not continue
>>>> until I ctrl-c it.  This script is the only user of the table, so DB
>>>> locking isn't involved.  The batches are only about 200k rows, but I set
>>>> the withBatch() parameter to 25k to be nice to the DB.  Has anybody seen
>>>> this before?  Any suggestions?  Thanks!
>>>>
>>>> D
>>>>
>>>
>>>
>>
>

Mime
View raw message