SELECT _comment.*, _article.title as article_title, _article.reference as article_reference FROM _comment JOIN _article ON _comment.parent_id = _article.id WHERE _comment.path <@ '0.1.635696' ORDER BY (localtimestamp - _comment.date_publishing) ASC OFFSET 0 LIMIT 5; ---- ------------------ Limit (cost=37638.01..37638.02 rows=5 width=581) (actual time=4.381..4.426 rows=5 loops=1) -> Sort (cost=37638.01..37654.12 rows=6444 width=581) (actual time=4.371..4.385 rows=5 loops=1) Sort Key: (('now'::text)::timestamp without time zone - _comment.date_publishing) -> Nested Loop (cost=422.56..37230.30 rows=6444 width=581) (actual time=1.151..3.909 rows=52 loops=1) -> Bitmap Heap Scan on _comment (cost=422.56..14230.64 rows=6444 width=547) (actual time=1.007..1.360 rows=71 loops=1) Recheck Cond: (path <@ '0.1.635696'::ltree) -> Bitmap Index Scan on gist_idx_comment_path (cost=0.00..420.95 rows=6444 width=0) (actual time=0.973..0.973 rows=71 loops=1) Index Cond: (path <@ '0.1.635696'::ltree) -> Index Scan using _article_pkey on _article (cost=0.00..3.55 rows=1 width=42) (actual time=0.017..0.020 rows=1 loops=71) Index Cond: (_comment.parent_id = _article.id) Total runtime: 4.760 ms (11 rows)