Problem using LIMIT 1 when only 1 record exists.

Поиск
Список
Период
Сортировка
От Steve Thames
Тема Problem using LIMIT 1 when only 1 record exists.
Дата
Msg-id AHEHICJPCIJDKAMKKIHBKELICNAA.steve@softlife.com
обсуждение исходный текст
Ответы Re: Problem using LIMIT 1 when only 1 record exists.
Список pgsql-bugs
I have a table with 14,655,100 rows in it.  No unique keys.
I have an index on the fields "symbol", varchar[12], and "qdate", int4 as
format=YYYYMMDD.
I have a field called "expmoyr", char[6] as format=Mmm-YY.
I have a field called "last", float4.

The SQL command:
SELECT last FROM table WHERE symbol='Symbol' AND expmoyr='Mmm-YY' ORDER BY
qdate DESC LIMIT 1;

This query works fine when there is more than one record meeting the
criteria.  When there is only 1, the query locks and no result is returned.

I have tried vacuuming and reindexing the entire database several times.
Please let me know if there is a fix to this.

Thanks.
Steve Thames
Softlife Consulting, Inc.
530-672-6908
www.softlife.com

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

Предыдущее
От: Javier Carlos
Дата:
Сообщение: Re: SELECT with MANY tables
Следующее
От: Mark Iszler
Дата:
Сообщение: Problem with building PostgreSQL 7.4 from source