The generator value does not change and will return his last value (which is not the same value as in the table)
Von: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] Gesendet: Dienstag, 4. Februar 2020 13:22 An: firebird-support@yahoogroups.com Betreff: Re: [firebird-support] Bad performance with select first(1) + order by I fixed the update statement with "UPDATE ... where PRIMKEY= GEN_ID(gen_primkey_counter,0)" and execution fell from 20s to 0,4. :-) Now a final question, what would GEN_ID(gen_primkey_counter,0) return, when I delete the last n entries of the table? It's fun to implement FB with such a great and instant support! Thanks! On Tue, Feb 4, 2020 at 1:12 PM Matthias Winkler <spmm...@gmail.com<mailto:spmm...@gmail.com>> wrote: Hello SD, YES!!!! That kind of thing is what I was looking for, I guess. Thanks On Tue, Feb 4, 2020 at 12:52 PM Dimitry Sibiryakov s...@ibphoenix.com<mailto:s...@ibphoenix.com> [firebird-support] <firebird-support@yahoogroups.com<mailto:firebird-support@yahoogroups.com>> wrote: 04.02.2020 12:47, Matthias Winkler spmm...@gmail.com<mailto:spmm...@gmail.com> [firebird-support] wrote: > But I need to deal with a heap of old code and re-designing > it, is not a real option :-) Still you can use "update or insert ... matching gen_id(...., 0)" instead. -- WBR, SD. ------------------------------------ ------------------------------------ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Visit http://www.firebirdsql.org and click the Documentation item on the main (top) menu. Try FAQ and other links from the left-side menu there. Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ------------------------------------ Yahoo Groups Links ub.unitel GmbH, Schulstraße 16, 06792 Sandersdorf-Brehna Geschaeftsfuehrung Klaus Richter, Olaf Meyer Amtsgericht Stendal HRB 26389 FA Bitterfeld Steuernr. 116/107/08597 Ust.identNr. DE815796778 Deutsche Bank IBAN DE53 86070024 0 6143234 00 Kreissparkasse Anhalt-Bitterfeld IBAN DE69 80053722 0 3050326 82 _____________________________________________________________________ Dieses E-Mail ist nur für den Empfänger bestimmt, an den es gerichtet ist und kann vertrauliches bzw. unter das Berufsgeheimnis fallendes Material enthalten. Jegliche darin enthaltene Ansicht oder Meinungs- äußerung ist die des Autors und stellt nicht notwendigerweise die Ansicht oder Meinung von ub.unitel GmbH dar. Sind Sie nicht der Empfänger, so haben Sie diese E-Mail irrtümlich erhalten und jegliche Verwendung, Veröffentlichung, Weiterleitung, Abschrift oder jeglicher Druck dieser E-Mail ist strengstens untersagt. _____________________________________________________________________