On 5/2/07, Tito Ciuro <[EMAIL PROTECTED]> wrote:
Hello,

Assume the following scenario: I store people in a table, like this:

People
        ROWID, idx
        GUID, idx
        First, idx
        Last, idx
        Email
        ...

In the app, the user can select People GUIDs from different sources
and then retrieve the info from the database. The easy/suboptimal
route to retrieve the records would be to perform a SELECT per GUID
selected. I thought of something like this:

SELECT * FROM People where GUID in ("ABC", "RDT", "TUV");

Is there a better way to include all these GUIDs on a single SQL
statement to speed things up?

When you say "speed things up," is it not fast enough yet? Numbers
would be helpful.

Questions I have:

1) Is this the best way to solve the problem? Suggestions?

unless you change your attribution (for example, tag your data by
GUID-types, if there is such a thing in your case), the above is the
best way, perhaps the only way. Internally, I believe the IN clause
gets converted to a set of OR matches as in
GUID = 'ABC' OR GUID = 'XYZ' OR... (or is it the other way around?)

2) Is there a limit on the number of parameters I can pass to "in"?

dunno... try it.

What if I have, say, 500 to retrieve? Will SQLite complain about this?

try it, if SQLite complains, you will know, and you will have to
approach the problem differently ;-)



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------




--
Puneet Kishor http://punkish.eidesis.org/
Nelson Inst. for Env. Studies, UW-Madison http://www.nelson.wisc.edu/
Open Source Geospatial Foundation http://www.osgeo.org/education/
---------------------------------------------------------------------
collaborate, communicate, compete
=====================================================================

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to