to prevent ordering you can use index to select in any order you want

select /*+ INDEX_ASC(tableX  indexNameforColX) */ * from tableX 
where colX between  value1 and value2 


select /*+ INDEX_DESC(tableX indexNameforColX) */ * from tableX 
where colX between  value1 and value2 


but, I dont know IBATIS allows hint usage !!!


-----Original Message-----
From: Johan Oskarsson [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 02, 2006 2:09 PM
To: [email protected]
Subject: limit/offset vs setFetchSize()


Hi.

I'm refactoring a program that indexes database entries in a lucene index.
I decided to move all the jdbc code to using ibatis instead.
However I seem to have run into a problem.

The old code simply iterated through the resultset
and processed everything that way, using a: st.setFetchSize(10000);
to limit the number of rows to be returned.

I first copied the query and ran it using ibatis. But since there's 
roughly 30 million
rows in the resultset the memory quickly runs out.

I switched to using a custom rowhandler that processes the row without
saving anything into memory. This unfortunately didn't help. Now I'm using
the limit offset tactic to process chunks of the data. This requires me 
to add
"order by" to the query, which in this case means the query will take 
forever to run.
The easiest way would probably be to go back to the old code, but I 
prefer ibatis.

What can I do to avoid this problem?
I'm not exactly an sql expert so any advice is welcome.

/Johan
 
 
Bu elektronik posta mesaji ve ekleri sadece gönderildigi kisi veya kuruma 
özeldir ve gizli bilgiler içerebilir. Eger bu mesaji hataen aldiysaniz lütfen 
bu durumu gönderen kisiye derhal bildiriniz ve mesaji sisteminizden siliniz. 
Eger dogru kisiye ulasmadigini düsünüyorsaniz, bu mesajin gizlenmesi, 
yönlendirilmesi, kopyalanmasi veya herhangi bir sekilde kullanilmasi yasaktir. 
Internet iletisiminde güvenlik ve hatasiz gönderim garanti edilemeyeceginden, 
mesajin yerine ulasmamasi, geç ulasmasi, içeriginin bozulmasi ya da mesajin 
virus tasimasi gibi problemler olusabilir. Gönderen taraf bu tip sorunlardan 
sorumlu tutulmaz.

This e-mail message and any attachments are confidential and intended solely 
for the use of the individual or entity to whom they are addressed. If you have 
received this message in error, please notify the sender immediately and delete 
it from your system. If you are not the intended recipient you are hereby 
notified that any dissemination, forwarding, copying or use of any of the 
information is prohibited. Internet communications cannot be guaranteed to be 
secure or error-free as information could be intercepted, corrupted, lost, 
arrive late or contain viruses. The sender therefore does not accept liability 
for any errors or omissions in the context of this message which arise as a 
result of Internet transmission.

Reply via email to