Question: Using Boost.Python, how can I define a module inside another (or rather, as if it were located in a folder)?

Answer: 
Solution (without altering the indexes on my tables):

```

SELECT df.*,
       (
        SELECT dfa.file_archive_id
          FROM dca_file_archive dfa
          WHERE df.file_id = dfa.file_id
          ORDER BY dfa.file_archive_version desc LIMIT 1
       ) as file_archive_id,
       (
        SELECT dfa.file_archive_version
          FROM dca_file_archive dfa
          WHERE df.file_id = dfa.file_id
          ORDER BY dfa.file_archive_version desc LIMIT 1
       ) as file_archive_version
FROM dca_file df

```

Both tables having ~16k rows, this statement takes 0.9 seconds to perform, which is 120x faster than the first join solution.

I know this is not the finest you can do with SQL
Try this one -

```
SELECT f.*, a1.file_archive_id, a1.file_archive_version FROM files f
JOIN file_archives a1
  ON f.file_id = a1.file_id
JOIN (
  SELECT file_id, MAX(file_archive_version) max_file_archive_version FROM file_archives GROUP BY file_id
  ) a2
  ON a1.file_id = a2.file_id AND a1.file_archive_version = a2.max_file_archive_version;

```