Performance when storing pages with SQLite using the pagetable plugin

Hi! I am trying to use an SQLite database to store a particular a particular type of pages, in this case attendees for an event. (We are using to SQLite in order to integrate smoothly with iPad check-off app.)

I am using the approach outlined in Content from a database | Kirby CMS, and for the most part it works great!

However, I now have a particular table of attendees with ~5000 rows, and the request, in the panel to the attendees page, yields a 500 Internal Server Error.


I get the following response message in the console:

Failed to open stream: Too many open files

When I disabled UUID’s, I got a 502 Bad Gateway Error instead.

My models/attendees.php goes as follows, slightly abbreviated:

class AttendeesPage extends Kirby\Cms\Page

  public function children()

    $attendees = [];

    $allAttendees = getAttendeeDatabase()->table('attendees')->all();

    foreach ($allAttendees as $attendee) {
      $attendees[] = [
        'slug'     => $attendee->slug(),
        'template' => 'attendee',
        'model'    => 'attendee',
        'content'  => [
          'name'  => $attendee->name(),
          'slug'  => $attendee->slug(),
          // Some more fields here.

    return Pages::factory($attendees, $this);

The getAttendeeDatabase function is defined in a plugin and goes roughly like this:

public function getAttendeeDatabase()

  $database = new Database(
      'type'     => 'sqlite',
      'database' => $this->root() . '/attendees.sqlite'

  // Code here for creating the table if it does not exist

  return $database;

In the above-mentioned guide it says:

With lots of entries it would also become necessary to work on a custom collection for the result set that would only fetch the rows it really needs, but this would be more complex.

Is there an example of this anywhere? I think this is what I need, but I’m not sure. Any help is much appreciated!