It is safe to run many DDL commands in EXECUTE BLOCK?

15 views
Skip to first unread message

Attila Molnár

unread,
Apr 9, 2024, 4:38:14 AMApr 9
to firebird-general
Hi *!

The goal is to run many DDL commands in a single transaction as fast as possible.

In general it is not advised to mix DDL commands with other kind of commands in the same transaction. But I could not find an exact definition which kind of other commands usage are not advised and the reason why it is unsafe/risky.

EXECUTE BLOCK
AS
BEGIN
  EXECUTE STATEMENT 'ddl';
  EXECUTE STATEMENT 'ddl';
...
  EXECUTE STATEMENT 'ddl';
  EXECUTE STATEMENT 'ddl';
END

Thank you!

Dimitry Sibiryakov

unread,
Apr 9, 2024, 5:23:05 AMApr 9
to firebird...@googlegroups.com
Attila Molnár wrote 09.04.2024 10:38:
> In general it is not advised to mix DDL commands with other kind of commands in
> the same transaction. But I could not find an exact definition which kind of
> other commands usage are not advised and the reason why it is unsafe/risky.

DLL commands are not executed whole at the moment you send them to server.
Some pieces of work are scheduled until transaction commit. It is not advised to
execute commands that rely on this deferred part of work. Such queries throw
errors or (in past) crash Firebird.

--
WBR, SD.

Reply all
Reply to author
Forward
0 new messages