Re: Finding uniques across a big join

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Finding uniques across a big join
Дата
Msg-id 20051130065555.GE23691@svana.org
обсуждение исходный текст
Ответ на Finding uniques across a big join  ("John D. Burger" <john@mitre.org>)
Ответы Re: Finding uniques across a big join  ("John D. Burger" <john@mitre.org>)
Список pgsql-general
On Tue, Nov 29, 2005 at 09:58:49PM -0500, John D. Burger wrote:
> I could use some help with the following:
>
> I have a database of geographic entities with attributes spread across
> several tables.  I need to determine which entities are unique with
> respect to some of those attributes.  I'm using the following query:

<snip>

If you put the gazPlaceID as a result of the uniqs subquery, that would
avoid the second lookup, right? Whether it's much faster is the
question. So something like:

select p1.gazPlaceID
     from gazPlaces as p1
       join gazNamings as n1 using (gazPlaceID)
       join gazContainers as c1 using (gazPlaceID)
     group by p1.gazPlaceID, p1.featureType, n1.placeNameID, c1.containerID
     having count(*) = 1

Secondly, what does the plan look like? Is it materialising or sorting
at any stage?

Finally, what version of postgres?

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: selecting a attribute from a function
Следующее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: memory leak under heavy load?