Re: Arrays and foreign keys
От | Stephan Szabo |
---|---|
Тема | Re: Arrays and foreign keys |
Дата | |
Msg-id | Pine.BSF.4.10.10008101830050.65875-100000@megazone23.bigpanda.com обсуждение исходный текст |
Ответ на | Re: Arrays and foreign keys (Chris Bitmead <chrisb@nimrod.itg.telstra.com.au>) |
Список | pgsql-hackers |
On Fri, 11 Aug 2000, Chris Bitmead wrote: > Stephan Szabo wrote: > > > But (and this is a really big but) -- This is going to be slow as hell, > > and perhaps slower than that, since for any update or delete, you would > > have to go through every row on the other table doing the array in until > > we can get an index on all the elements in all of the arrays. > > > > Then there are other problematic issues like: > > {1,2,3} -> {1,3,4} -- Is this a delete of 2 and an insert of 4 or > > two updates? > > {1,2,3} -> {3,4,1} -- What about this one? > > Probably the only useful use of arrays in conjunction with referential > integrity is to treat the array as an unordered collection. > > {1,2,3} -> {1,3,4} -- Is a delete of 2 and an insert of 4. > > {1,2,3} -> {3,4,1} -- Is a delete of 2 and an insert of 4. > > For that reason I'm not sure that it has to be slow. When an array is > updated find the elements that have changed (according to the above > definition of changed) and only check on those ones. Remember, his structure was the array referenced the integer, not the other way around. So, if you say, delete one of the integers from the referenced table you need to find any array element that referenced that integer in all rows of the referencing table, that's the slow part.
В списке pgsql-hackers по дате отправления: