From: | Federico Di Gregorio <fog(at)dndg(dot)it> |
---|---|
To: | "W(dot) Matthew Wilson" <matt(at)tplus1(dot)com> |
Cc: | "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org> |
Subject: | Re: Is passing a list as a bound variable safe from SQL injection? |
Date: | 2013-10-03 07:53:45 |
Message-ID: | 524D2289.6050304@dndg.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
On 02/10/2013 18:31, W. Matthew Wilson wrote:
[snip]
> This is the approach (and it does involve very long lists):
>
> http://www.datadoghq.com/2013/08/100x-faster-postgres-performance-by-changing-1-line/
>
> Instead of writing = any(array[1,2,3,4]), they wrote = any(values (1),
> (2), (3), (4), )
>
> and somehow that works more quickly.
Hi Matthew,
you can override the list adapter and have it generate the "values"
expression instead of an array. See this example:
Btw, I am a little curious, what kind of query requires an array of
~11000 values? Surely there is a better way to write it, isn't it?
federico
--
Federico Di Gregorio federico(dot)digregorio(at)dndg(dot)it
Di Nunzio & Di Gregorio srl http://dndg.it
The only thing I see is if you are pumping so much data into the
database all the time when do you expect to look at it?
-- Charlie Clark
From | Date | Subject | |
---|---|---|---|
Next Message | Daniele Varrazzo | 2013-10-03 13:07:25 | Re: Is passing a list as a bound variable safe from SQL injection? |
Previous Message | W. Matthew Wilson | 2013-10-02 16:31:50 | Re: Is passing a list as a bound variable safe from SQL injection? |