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 (i named your tables `table1` and `table2`):

```
SELECT
    t1.fild_id,
    t1.file_name,
    t2A.file_archive_id,
    t2A.file_archive_version
FROM
    table1 t1
JOIN
    table2 t2A ON (t1.fild_id = t2A.file_id) 
WHERE
    NOT EXISTS (
        SELECT
            *
        FROM
            table2 t2B
        WHERE
            t2A.file_id = t2B.file_id
        AND
            t2B.file_archive_id > t2A.file_archive_id
    )
ORDER BY t1.fild_id

```