Set, SubSelect

Поиск
Список
Период
Сортировка
От George Johnson
Тема Set, SubSelect
Дата
Msg-id NEBBJGKMGLGMDGBMOHJNGEHJCAAA.gjohnson@jdsc.com
обсуждение исходный текст
Список pgsql-general
Hello All,

I spent yesterday and last nite reading the mailing lists and manual about:

select * from tab1 where tab1.id in ('id1','id2','id3');
select * from tab1 where tab1.id in (select tab1.id from tab1,tab2
where tab1.id = tab2.id);
select * from tab1 where exists (select tab1.id from tab1,tab2 where
tab1.id = tab2.id);

Ok, and etc, etc.

I read how what I really need is a 2nd table whose foreign keys can link in
with the table.  That would be great, but here is my scenerio:

I have around 1000 people who need to be able to store groups or 50-100
thousand numbers (saved search sets).  These numbers refer back to other
tables etc.  I'd love to be able to have a table like:

              sset#1          sset#2
----------------------------------------
person #1   0,1,2,3,5        10,12,13,15
person #2   5,6,74,44        23,55,43

I'd additionally love to be able to simply:

select * from my_big_data_table where exists (select sset#1 from
saved_sets where person = person #1);

In MySQL, there was a "find_in_set" function which was very handy and
very fast.  I tried the regex text string searching and really ended up
with pitiful lookup times.  I also am going to try taking advantage of the
unlimited select/insert/update lines and just throw a huge constant at it
(if the JDBC driver for 7.1 accepts large selects ... the 7.0 version does
not).

I'd love to hear how you guys would approach this.

Sincerely,
George Johnson


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

Предыдущее
От: Jarek
Дата:
Сообщение: Help in JDBC
Следующее
От: Benjamin Pflugmann
Дата:
Сообщение: Re: MySQL and PostgreSQL speed compare