Re: [SQL] Selecting with a large number of foreign keys

Поиск
Список
Период
Сортировка
От Ross J. Reedstrom
Тема Re: [SQL] Selecting with a large number of foreign keys
Дата
Msg-id 372F61B4.AC6BD458@rice.edu
обсуждение исходный текст
Ответ на Selecting with a large number of foreign keys  (Matt Behrens <matt@iserv.net>)
Ответы Re: [SQL] Selecting with a large number of foreign keys  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
Matt - 
We've been running into exactly the same problems you, for exactly the
same reason: we have a highly 'normalized' database design, in order to
easily populate drop-downs and picklists (get the users to enter the
right data by only giving them the right data!) You don't mention what
version of PostgreSQL you're using, but I bet it's 6.4.2. The
development team found some nasty problems in the query optimzer that
caused exactly these symptoms, and there are fixes in v6.5beta.  

The way to test if this is the problem is to try your query at the psql
prompt, then try an EXPLAIN of your query. IF the EXPLAIN takes a long
time (and a lot of memory), bingo!

One workaround until you can upgrade (the beta is shaking out bugs right
now) is to enable the Genetic Query Optimizer at a small number of
tables. This sort of short circuits the problem. Note that the WinODBC
driver disables GQO by default (if you're using that)

via SQL, do:
SET GEQO TO 'ON=5';

or some other small number: it's the number of tables in a 'join' at
which GEQO will take over.


HTH,
Ross

Matt Behrens wrote:
> 

<problem with large joins blowing up>

-- 
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> 
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005


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

Предыдущее
От: Matt Behrens
Дата:
Сообщение: Selecting with a large number of foreign keys
Следующее
От: Carlos Peralta Ramirez
Дата:
Сообщение: Help me please !!!!