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))
Список pgsql-sql
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