Re: What's faster?

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: What's faster?
Дата
Msg-id 43EB64C4.2090003@magproductions.nl
обсуждение исходный текст
Ответ на What's faster?  ("Silas Justiniano" <silasju@gmail.com>)
Список pgsql-general
Silas Justiniano wrote:
> 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

If you don't care about how many pages you'll get, try:

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

--
Alban Hertroys
alban@magproductions.nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
    7500 AK Enschede

//Showing your Vision to the World//

В списке pgsql-general по дате отправления:

Предыдущее
От: Dan Armbrust
Дата:
Сообщение: Re: Create a new database from JDBC?
Следующее
От: Jennifer Drake
Дата:
Сообщение: PQputline error with pg_restore