restricting select statements

Поиск
Список
Период
Сортировка
От Bob VonMoss
Тема restricting select statements
Дата
Msg-id 36D38FB8.66E54888@bigfoot.com
обсуждение исходный текст
Ответы Re: [GENERAL] restricting select statements  (jim@reptiles.org (Jim Mercer))
Список pgsql-general
I'm working with JDBC and if I issue a broad SELECT statement, with a
good amount of records (2000) it takes quite a while to execute the
query and send the results back, even up to a minute, when I only want
about the first 100 records. If I restrict the search, it is satisfied
in a much more reasonable amount of time. The problem is that I can only
know how big the database. I could do a count and get an idea of how
large the database is and make a guess that the data is uniformly
distributed. There was a java command to restrict the number of records
saved setMaxSize(); but this does not seem to decrease the time of
execution of executeQuery(), and probably only uses less local memory.

If I have a statement like:

SELECT * FROM a;

and only want about the first 150 records, is there a way of speeding up
the query without doing a count(*) on a and doing something like this:

SELECT * FROM a WHERE '' <= a AND a < 'C';

--
Bob VonMoss
mailto:bvonmoss@bigfoot.com
from Chicago, IL



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

Предыдущее
От: strawman@plexi.com
Дата:
Сообщение: timestamps
Следующее
От: jim@reptiles.org (Jim Mercer)
Дата:
Сообщение: Re: [GENERAL] restricting select statements