All pastes #568106 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-06-15 08:31 UTC
rendered paste body
SELECT id, parent_id, reference, text, data, date_publishing
FROM  _comment
WHERE _comment.parent_id = '1001206797'
ORDER BY (localtimestamp - _comment.date_publishing) DESC
OFFSET 0
LIMIT  50 


QUERY PLAN

Limit  (cost=8030.55..8030.67 rows=50 width=436) (actual time=230.041..230.086 rows=50 loops=1)

  ->  Sort  (cost=8030.55..8048.05 rows=7003 width=436) (actual time=230.038..230.057 rows=50 loops=1)

        Sort Key: (('now'::text)::timestamp without time zone - date_publishing)

        ->  Index Scan using idx_comment_parent_id on _comment  (cost=0.00..7583.27 rows=7003 width=436) (actual time=0.186..200.134 rows=7439 loops=1)

              Index Cond: (parent_id = 1001206797::bigint)

Total runtime: 233.662 ms

6 ligne(s)
----------------------------------------------------------------------------

SELECT id, parent_id, reference, text, data, date_publishing
FROM  _comment
WHERE _comment.parent_id = '1001206797'
ORDER BY _comment.date_publishing ASC
OFFSET 0
LIMIT  50 

QUERY PLAN

Limit  (cost=0.00..6126.10 rows=50 width=436) (actual time=16557.777..16734.163 rows=50 loops=1)

  ->  Index Scan using idx_comment_date_publishing on _comment  (cost=0.00..858021.75 rows=7003 width=436) (actual time=16557.774..16734.103 rows=50 loops=1)

        Filter: (parent_id = 1001206797)

Total runtime: 16734.269 ms