Re: [PERFORM] Search query is curious

2010-08-17 Thread Maciek Sakrejda
> without ORDER BY database returns first 15 rows where predicate is > true. With ORDER BY the database has to find all rows where predicate > is true and then has to sort it. So first case can be a much faster > because there are not necessary full table scan. Right. Essentialy, the ORDER BY happ

Re: [PERFORM] Search query is curious

2010-08-17 Thread Pavel Stehule
Hello 2010/8/17 : > > Hi, > > I've database of lyrics and I'm using this query for suggest box. > SELECT views, title, id FROM songs  WHERE title ILIKE 'bey%' ORDER BY views > DESC LIMIT 15; > In query plan is this line:  ->  Seq Scan on songs  (cost=0.00..11473.56 > rows=5055 width=23) (actual

Re: [PERFORM] Search query is curious

2010-08-17 Thread Thom Brown
On 17 August 2010 08:26, wrote: > > Hi, > > I've database of lyrics and I'm using this query for suggest box. > SELECT views, title, id FROM songs  WHERE title ILIKE 'bey%' ORDER BY views > DESC LIMIT 15; > In query plan is this line:  ->  Seq Scan on songs  (cost=0.00..11473.56 > rows=5055 wid

[PERFORM] Search query is curious

2010-08-17 Thread fiala_marek
Hi, I've database of lyrics and I'm using this query for suggest box. SELECT views, title, id FROM songs WHERE title ILIKE 'bey%' ORDER BY views DESC LIMIT 15; In query plan is this line: -> Seq Scan on songs (cost=0.00..11473.56 rows=5055 width=23) (actual time=1.088..89.863 rows=77 loops=