Re: Fetch a single record

Поиск
Список
Период
Сортировка
Искать
От
Paul Thomas
Тема
Re: Fetch a single record
Дата
Msg-id
20031210001129.A30762@bacon
Ответ на
Fetch a single record (david_shadovitz@xontech.com (David Shadovitz))
Список
Дерево обсуждения
Fetch a single record david_shadovitz@xontech.com (David Shadovitz)
Re: Fetch a single record Peter Eisentraut <peter_e@gmx.net>
Re: Fetch a single record Paul Thomas <paul@tmsl.demon.co.uk>
Re: Fetch a single record greg@turnstep.com

On 05/12/2003 21:51 David Shadovitz wrote:
> I'm looking for the fastest way to fetch a single record from a table.
>  I don't care what record it is.
> [snip]

Have you also tried  SELECT * from mytable limit 1

If you genuinely don't care what the record is (I assume you're justing 
testing that table is not empty?) then this might be the way to go. My 
rather limited knowledge of PG internals leads me to believe that this 
will generally cause just one page being read from disk (I'm assuming the 
99% case of no mega-sized text/bytea/whatever columns here). I'd be 
interested to know just how far off the mark by understanding is...

-- 
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller 
Business |
| Computer Consultants         | 
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+

В списке pgsql-sql по дате отправления
От: Stephan Szabo
Дата:
Сообщение: Re: Values like ''
От: greg@turnstep.com
Дата:
Сообщение: Re: Fetch a single record
FAQ