Subject | Re: [firebird-support] Re: How to handle a large 'IN' clause? |
---|---|
Author | Pavel Menshchikov |
Post date | 2005-04-10T10:00:48Z |
Hello Phil,
p> ... but even if the data is in a temporary table, would that not still
p> give me a problem when I select over 1500 records in the 'in' clause?
p> When the user selects some records this is completely arbitrary and
p> there is no database relationship that can cater for this.
p> Unless you meant that I should put all the selected records into a
p> temp table (Hmmm, I wonder how quick that'd be...) and select all PKs
p> from that as the argument in the original querys 'in' clause...?
Kjell mean that you should create temporary table with the user ID and
PK of your original table (for example). Then you fill the temporary
table with the data that the user (un)specified in your original
table, and perform joining or use construction like
... IN (SELECT OrigPK FROM TempTable WHERE UserID = :UID)
AFAIK, joins are more effective that the constuction above (IN(...)).
HTH
--
Best regards,
Pavel Menshchikov
http://www.ls-software.com
p> ... but even if the data is in a temporary table, would that not still
p> give me a problem when I select over 1500 records in the 'in' clause?
p> When the user selects some records this is completely arbitrary and
p> there is no database relationship that can cater for this.
p> Unless you meant that I should put all the selected records into a
p> temp table (Hmmm, I wonder how quick that'd be...) and select all PKs
p> from that as the argument in the original querys 'in' clause...?
Kjell mean that you should create temporary table with the user ID and
PK of your original table (for example). Then you fill the temporary
table with the data that the user (un)specified in your original
table, and perform joining or use construction like
... IN (SELECT OrigPK FROM TempTable WHERE UserID = :UID)
AFAIK, joins are more effective that the constuction above (IN(...)).
HTH
--
Best regards,
Pavel Menshchikov
http://www.ls-software.com