query on multiple db in firebird

232 views
Skip to first unread message

Raffaele Bruzzese

unread,
Feb 10, 2024, 5:26:14 AM2/10/24
to firebird-support
Hello
in sqlserver is possible run query on table located in different DB on same server. 

For example:
select DB1.dbo.tablea.cod_int, DB2.dbo.tableb.desc from
DB1.dbo.tablea join DB2.dbo.tableb on DB2.dbo.tableb.cod_int=DB1.dbo.tablea.cod_int

same is not possible in FIREBIRD ? I hope that this is included in Firebirb 5 ?

Thanks
Raffaele Bruzzese
 

Mark Rotteveel

unread,
Feb 10, 2024, 5:27:53 AM2/10/24
to firebird...@googlegroups.com
No, cross-database queries are not supported in Firebird (also not in
Firebird 5, which is already released).

Mark
--
Mark Rotteveel

Dimitry Sibiryakov

unread,
Feb 10, 2024, 5:49:24 AM2/10/24
to firebird...@googlegroups.com
Raffaele Bruzzese wrote 10.02.2024 11:25:
> same is not possible in FIREBIRD ? I hope that this is included in Firebirb 5 ?

No. Firebird is powerful enough to handle all data stored in one database.
There is no need to split them.

--
WBR, SD.

Mark Rotteveel

unread,
Feb 10, 2024, 5:51:29 AM2/10/24
to firebird...@googlegroups.com
That is bogus reasoning.

--
Mark Rotteveel

Dimitry Sibiryakov

unread,
Feb 10, 2024, 5:53:30 AM2/10/24
to firebird...@googlegroups.com
'Mark Rotteveel' via firebird-support wrote 10.02.2024 11:51:
>>
>>    No. Firebird is powerful enough to handle all data stored in one database.
>> There is no need to split them.
>
> That is bogus reasoning.

Usual reason for using multiple MS SQL databases is its 10 Gb database size
limit for single database. Firebird has much bigger limit for database size.

--
WBR, SD.

Mark Rotteveel

unread,
Feb 10, 2024, 5:55:24 AM2/10/24
to firebird...@googlegroups.com
SQL Server has no such limitation, see
https://learn.microsoft.com/en-us/sql/sql-server/maximum-capacity-specifications-for-sql-server?view=sql-server-ver16
:

Database size 524,272 terabytes

Mark
--
Mark Rotteveel

Mark Rotteveel

unread,
Feb 10, 2024, 5:57:14 AM2/10/24
to firebird...@googlegroups.com
Though to reach that size, you will need to use multiple data files,
because individual data files are restricted to 16 terabytes.

Mark
--
Mark Rotteveel

Dimitry Sibiryakov

unread,
Feb 10, 2024, 5:59:21 AM2/10/24
to firebird...@googlegroups.com
'Mark Rotteveel' via firebird-support wrote 10.02.2024 11:55:
> SQL Server has no such limitation, see
> https://learn.microsoft.com/en-us/sql/sql-server/maximum-capacity-specifications-for-sql-server?view=sql-server-ver16 :
>
> Database size     524,272 terabytes

This is rather
https://learn.microsoft.com/en-us/sql/sql-server/editions-and-components-of-sql-server-2022?view=sql-server-ver16

Maximum relational database size 524 PB 524 PB 524 PB 10 GB 10 GB

Compare free DBMSs.

--
WBR, SD.

Mark Rotteveel

unread,
Feb 10, 2024, 6:02:16 AM2/10/24
to firebird...@googlegroups.com
Again, bogus reasoning. Microsoft wants to get paid if you have a big
database and thus limits there free offerings. That does not mean you
can claim that SQL Server only supports 10 GB databases.

In fact, you are far more likely to encounter cross-database queries in
enterprise situations, where a paid version of SQL Server is used.

Mark
--
Mark Rotteveel

Dimitry Sibiryakov

unread,
Feb 10, 2024, 6:10:19 AM2/10/24
to firebird...@googlegroups.com
'Mark Rotteveel' via firebird-support wrote 10.02.2024 12:02:
> In fact, you are far more likely to encounter cross-database queries in
> enterprise situations, where a paid version of SQL Server is used.

My experience is completely opposite: the most common usage of cross-database
queries is the workaround for exactly this limit.
Users of enterprice editions won't even ever ask about Firebird.

--
WBR, SD.

Raffaele Bruzzese

unread,
Feb 10, 2024, 6:49:24 AM2/10/24
to firebird...@googlegroups.com
Many thanks 

--
You received this message because you are subscribed to the Google Groups "firebird-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-suppo...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/firebird-support/04f853c7-9f83-40d6-a2b2-1fe70726cfc4%40ibphoenix.com.

Ertan Küçükoglu

unread,
Feb 10, 2024, 7:10:36 AM2/10/24
to firebird...@googlegroups.com
Hi,

You can do something like below

execute block returns (emp_no smallint) as
begin
FOR EXECUTE STATEMENT 'select emp_no from employee'
ON EXTERNAL DATA SOURCE 'localhost:employee' AS USER 'sysdba' PASSWORD 'masterkey'
INTO :emp_no
DO SUSPEND;
end


Raffaele Bruzzese <klioso...@gmail.com>, 10 Şub 2024 Cmt, 14:49 tarihinde şunu yazdı:

Raffaele Bruzzese

unread,
Feb 10, 2024, 7:25:13 AM2/10/24
to firebird...@googlegroups.com
Thanks , very interesting
i try it
Hello
Raf

Lucas Schatz

unread,
Feb 10, 2024, 7:49:55 AM2/10/24
to firebird...@googlegroups.com
So, in the case of a distributed system it's a very useful resource. It would be nice to at least do a join with an execute statement. Today I need to use execute block, declare variables, do a ` for execute statement.... Into....` then do the local select(or in reverse order too)
It's a lot of boilerplate to do this select from other databases. Don't know it exists, but an easier step would be welcome
Thanks 



Dimitry Sibiryakov

unread,
Feb 10, 2024, 8:24:25 AM2/10/24
to firebird...@googlegroups.com
Lucas Schatz wrote 10.02.2024 13:49:
> So, in the case of a distributed system it's a very useful resource.

It actually depends on the method and purpose of distribution.
Firebird is usually used with duplication so every node contains exactly the
same data and cross-queries are not needed.
In sharding information is not intersected between nodes so every query is
executed on exactly one shard (otherwise architect chose wrong sharding criteria).
Cross-queries used to be used in horizontal scaling that uses partial
sharding. This approach is very questionary.

--
WBR, SD.

Reply all
Reply to author
Forward
0 new messages