What's faster?

From: "Silas Justiniano" <silasju(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: What's faster?
Date: 2006-02-09 03:45:15
Message-ID: 1139456715.177179.159300@o13g2000cwo.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello all!

I'm performing a query that returns me hundreds of records... but I
need cut them in pages that have 15 items! (using PHP)

So, is it faster:

select blablabal from _complex_query
if (count($result) > 15) show_pages;
show_only_15_rows($result);

or:

select count(*) from _complex_query
if ($result1 > 15) show_pages;
select blablabal from _complex_query LIMIT ... (see the LIMIT!)
show $result

On the first, I can use pg_num_rows instead of count(), too.

what do you think?

Thank you!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-02-09 03:46:46 Re: Request to have VACUUM ignore cost based limits
Previous Message Rodolfo Campos 2006-02-09 03:36:44 Re: Insert into other database