I have to make a selection on which I have more than 1000 elements through hibernate, and then "ORA- 01795: The maximum number of expressions in the list is 1000 "When I'm using the Oracle brand.
SELECT * Metable WHERE column IN (?,?, ...) (> 1000 items)
I have many solutions Divide the list with:
where A (A, B, C, D, E, F) becomes
where (A, B, C) or one (D, E, F)) ...
UNION ALL Select a table with
Choose from all organizational additions (select v1 from dual union Select all v2 from a dual union Select one from v3 to a two union university ... Choose V2000 one-to-one) tmp.a = maintainable.id
border to get rid of tuples
Where (column, 0) in ((1,0), (2,0), (3,0), (4,0), ..., (1500,0))
Using a temporary table
select one item from my_temporary_table
Reference More
My question is: What is the best practice to deal with this issue? By best practice, I mean the most demonstrative, but not only for Oracle; If I want to be hibernate, then I do not want to create and manage a separate code for each brand's database (I'm worried about Oracle, MS SQL and Postgear).
My first reaction would be to use a floating table, but I do not know what is the most effect
Use a temporary table and consider the primary key on the table. It should allow very efficient optimization for comparison, like most are an index lookup, although if the table is too small, then Oracle can choose another method such as a table scan.
This method must be more than 1,000 or
conditions, sometimes in almost any database, is
optimized in values (values To store the binary tree), in such a database, the display will be identical.
No comments:
Post a Comment