Re: optimization join on random value

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: optimization join on random value
Дата
Msg-id 5546D4FA.6080904@BlueTreble.com
обсуждение исходный текст
Ответ на optimization join on random value  (Anton <djeday84@gmail.com>)
Список pgsql-hackers
On 5/3/15 4:15 PM, Anton wrote:
> Hello guru of postgres,  it's possoble to tune query with join on random
> string ?
> i know that it is not real life example, but i need it for tests.

Moving to -general, which is the proper list for this. (BCC -hackers)

 > soe-#         WHERE customer_id = trunc( random()*45000) ;

You could create a temp table with the random value and JOIN to it:

CREATE TEMP TABLE rnd AS SELECT random()*45000;

Another option might be to use a prepared statement:

PREPARE test AS SELECT ... WHERE customer_id = $1;
EXECUTE test( random()*45000 );
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com


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

Предыдущее
От: Jim Nasby
Дата:
Сообщение: Re: CTE optimization fence on the todo list?
Следующее
От: Dmitry Shirokov
Дата:
Сообщение: JSON data type and schema validation