Re: [cx-oracle-users] AW: cx-oracle-users digest, Vol 1 #99 - 8 msgs
Brought to you by:
atuining
|
From: Chris D. <cdu...@ya...> - 2005-05-12 08:23:11
|
Henning,
I know what you mean, but the issue is that this "if test" has to go in some sort of function and
be called for each col returned in each row and it's the function call overhead that's really the
issue. I'd like to use the following:
append = rowsOutput.append
for row in data: # where data is the resultset from a query
rowsGroup = rowsGroup + 1
append("%s%s%s%s" %(row[0], colSep, row[1], colSep)) # In reality many more columns
append(recSep)
if rowsGroup > :
outFile.write(''.join(rowsOutput))
rowsGroup = 0
rowsOutput = []
outFile.write(''.join(rowsOutput))
Now if I need to do the test on None then I believe I need to call a function or have the if test
inline in a loop and with many columns this is quite an overhead. In my test case on a 13 column
table returning 200K rows:
Doing the if test approx 20 CPU secs in Python
No if test approx 16 CPU secs secs in Python
A 20% reduction. I know the numbers here are small but given the app will be running against many
tables concurrently and extracting millions of rows the potential saving is significant.
Thanks for taking the time to respond.
Cheers,
Chris
--- Henning von Bargen <H.v...@t-...> wrote:
> Chris,
>
> why do you think the simple statement "if x is None: x=''" means an
> overhead?
> It means about 0.000(insert zeroes here)1 percent performance overhead,
> because transferring/outputting the data is what takes most of time.
>
> And - with Python - it should not mean too much typing overhead.
> You could easily write a function to do this automatically for each
> record.
>
> HTH
> Henning
>
>
> > -----Ursprüngliche Nachricht-----
> > From: Chris Dunscombe <cdu...@ya...>
> > To: cx-oracle-list <cx-...@li...>
> > Subject: [cx-oracle-users] Nulls returned as None and not as
> > as "empty or zero lenght string"
> > Reply-To: cx-...@li...
> >
> > All,
> >
> > Is there anyway that Null values returned from a query can be
> > an "empty or zero length string"
> > instead of None?
> >
> > This may seem a strange request as it's easy to use type to
> > test if a null has been returned as
> > None. However I've a performance critical app where I need to
> > output "nothing" (zero length /
> > empty string) if the value is null. Hence at present I have
> > to perform this "type test" on ALL
> > columns that don't have a "Not Null" constraint in the
> > database which is quite an overhead when in
> > some cases I need to do it millions and sometimes billions of times.
> >
> > Thanks,
> >
> > Chris Dunscombe
> >
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_ids93&alloc_id281&op=click
> _______________________________________________
> cx-oracle-users mailing list
> cx-...@li...
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|