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 |
+------------------------------+---------------------------------------------+