Re: sequence caches
От | Tom Lane |
---|---|
Тема | Re: sequence caches |
Дата | |
Msg-id | 460.1053454154@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: sequence caches (jks@selectacast.net) |
Список | pgsql-general |
jks@selectacast.net writes: >> Seems that would require predicting the future. How would you know how >> many times the sequence would get nextval'd in one query? > Because you parse the query before you take any action, so you know how > many times the nextval will be called. No you don't. Consider CASE expressions, SELECTs that will return an uncertain number of rows, etc. > Or do you do the locking down in > the nextval method that knows nothing about the other nextvals? Exactly. > Perhaps > there could be a function call that retrieves X sequence numbers from the > sequence that overrides the cache settings so I could query like: > SELECT nextval('seqname',3),nextval('seqname'),nextval('seqname'); Doesn't really seem worth the trouble to me. To take just one obvious problem, what makes you think that those expressions will be evaluated left-to-right? There are no guarantees of execution order in SQL. regards, tom lane
В списке pgsql-general по дате отправления: