Re: nested query on last n rows of huge table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Feb 24, 2006, at 23:13 , jcfischer wrote:

Is there a way to limit the expensive query to only those last 1000 (or
whatever) results?


I have tried to nest SELECTS but my SQL-fu is to limited to get
anything through the SQL processor :-)

The basics of a subquery are:

SELECT <expensive query>
FROM (
	SELECT *
	FROM table
	ORDER eventtime DESC
	LIMIT 1000
	) as most_recent_1000

Don't know enough about the other parts, but hopefully this can get you started. :)

Michael Glaesemann
grzm myrealbox com





[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux