| От | Chad Thompson |
|---|---|
| Тема | Re: Select Statement Hang... |
| Дата | |
| Msg-id | 005001c34fb2$6674a7c0$32021aac@chad обсуждение исходный текст |
| Ответ на | Select Statement Hang... (ttzhang <ttzhang@uclink.berkeley.edu>) |
| Список | pgsql-novice |
> I was trying to set up a foreign key for an id field but found out that some > of the ids are not in the referenced table. To look things up, I tried > > select id from btable where id not in (select id from atable) > > The query just hang..... My tables are pretty big (200, 000?) can anyone > help me to pinpoint the problem? > > Thanks! > You might try select id from btable where not exists (select id from atable) I have found that this performs better. You should also make sure that you've vacuumed your tables. If this doesnt help, post the results of explain analyze select id from btable where not exists (select id from atable) HTH Chad
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера