multi query slow
This is the most ludicrous and unrealistic ticket I've seen in a long time. There's no reason you should write your code in this way, in my opinion.

If you want to get `None` for the missing values, then you could do something like this:

```python
query = ModelClass.select().order_by(ModelClass.id)

last_id = current_id = 0
missing_ids = []
for obj in query:
    current_id = obj.id
    if current_id != last_id + 1:
        missing_ids.extend(range(last_id, current_id))
    last_id = current_id
```

Does that make sense? Thanks for reply.
Your suggestion would work in most cases, but in my case, the table has millions of rows, and I do not think putting all of them in memory is a good idea.
What I need is a function like `def get_models_by_ids(ids): ...`, and when the given id is not found in the table, get a `None` instead.
And I finally found a not elegant way:
```
def get_models_by_ids(given_ids):
    query = ModelClass.select().where(ModelClass.id << given_ids)
    id2model = {model.id: model for model in query}
    models = [id2model.get(id_) for id_ in given_ids]
    return models
```
It is ugly but it really worked. Does peewee have a better way to do things like that? May be it's ludicrous, but I really need a function like that. Peewee can be made to use less RAM when iterating over large result-sets by chaining a call to `.iterator()` in your query:

```python
query = ModelClass.select().order_by(ModelClass.id).iterator()

last_id = current_id = 0
missing_ids = []
for obj in query:
    current_id = obj.id
    if current_id != last_id + 1:
        missing_ids.extend(range(last_id, current_id))
    last_id = current_id
```

The solution you've commented should work fine, too, of course.

Peewee doesn't include anything like what you're asking for, no. Thanks for your explanation
I have thousands of ids for a table,and I want to query model one by one by use `xxx.select().filter(id==id).first()` in a for loop(not used `>>` operator because if the given id not exist in the table, I want to get None), but this way need thousands of db query and the huge total time() is unacceptable.
I need the query result is in order and be None if the given id not found in the table, of course as fast as possible, anyone has some good ideas? 