Re: SELECT TOP %d PERCENT, or SELECT ... LIMIT %d PERCENT ?

Поиск
Список
Период
Сортировка
От Hitoshi Harada
Тема Re: SELECT TOP %d PERCENT, or SELECT ... LIMIT %d PERCENT ?
Дата
Msg-id e08cc0400810120554q38ef1769wf41c7ddb3d28dccf@mail.gmail.com
обсуждение исходный текст
Ответ на SELECT TOP %d PERCENT, or SELECT ... LIMIT %d PERCENT ?  (Grzegorz Jaskiewicz <gj@pointblue.com.pl>)
Ответы Re: SELECT TOP %d PERCENT, or SELECT ... LIMIT %d PERCENT ?  (Grzegorz Jaskiewicz <gj@pointblue.com.pl>)
Список pgsql-hackers
2008/10/12 Grzegorz Jaskiewicz <gj@pointblue.com.pl>:
> so I wonder, quite few times ppl asked me about my-word database TOP %
> PERCENT (and I guess ms-word db has it too).
> Now that postgres has limit(subselect) - postgresql can do the same thing.
> But, using a count(*) in subselects isn't very efficient. The backend gets
> information from limit X, so I figure it shouldn't be a very big deal to add
> LIMIT %d PERCENT , and pass it on as percentage, instead of just number of
> rows.
> I can give it a go and try to implement it myself, but wanted to ask here
> first for opinion on syntax (I have no idea what would be right syntax by
> sql standards), and how keen would you guys be on accepting such patch.
>
> thanks.
>
>

I'm afraid you will not succeed it because PostgreSQL doesn't know how
many rows are totally returned until it returns the last row, which is
as ineficient as count(*) as you point out.

Regards,


-- 
Hitoshi Harada


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

Предыдущее
От: Grzegorz Jaskiewicz
Дата:
Сообщение: SELECT TOP %d PERCENT, or SELECT ... LIMIT %d PERCENT ?
Следующее
От: Grzegorz Jaskiewicz
Дата:
Сообщение: Re: SELECT TOP %d PERCENT, or SELECT ... LIMIT %d PERCENT ?