Subject | RE: [firebird-support] What programming languages and toolkits do you use to access Firebird? |
---|---|
Author | RB Smissaert |
Post date | 2008-09-30T18:35:43Z |
Have run this now and it works fine, but unfortunately the tables I am
interested in have no primary key.
Still, it is interesting to know this SQL, although I must admit I don't
understand it.
Will have a look if a kind of binary search (run in a loop from the
application) on the rdb$db_key will do it.
RBS
_____
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Si Carter
Sent: 30 September 2008 17:40
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] What programming languages and toolkits do
you use to access Firebird?
Perhaps something like the following would work for you
-- This wil only work on tables that have a primary key.
UPDATE RDB$INDICES SET RDB$STATISTICS = -1;
COMMIT;
/* Display table names and record counts */
SELECT RDB$RELATIONS.RDB$RELATION_NAME,
CASE WHEN RDB$INDICES.RDB$STATISTICS = 0 THEN 0 ELSE
CAST(1 / RDB$INDICES.RDB$STATISTICS AS INTEGER) END
FROM RDB$RELATIONS
LEFT JOIN RDB$RELATION_CONSTRAINTS ON
RDB$RELATIONS.RDB$RELATION_NAME =
RDB$RELATION_CONSTRAINTS.RDB$RELATION_NAME
AND RDB$CONSTRAINT_TYPE = 'PRIMARY KEY'
LEFT JOIN RDB$INDICES ON
RDB$RELATION_CONSTRAINTS.RDB$INDEX_NAME = RDB$INDICES.RDB$INDEX_NAME
WHERE RDB$VIEW_BLR IS NULL AND
RDB$RELATION_ID >= 128
ORDER BY 1;
its not 100% accurate but might be what your looking for
rgds
Si
On Tue, Sep 30, 2008 at 5:14 PM, <bartsmissaert@
<mailto:bartsmissaert%40blueyonder.co.uk> blueyonder.co.uk> wrote:
interested in have no primary key.
Still, it is interesting to know this SQL, although I must admit I don't
understand it.
Will have a look if a kind of binary search (run in a loop from the
application) on the rdb$db_key will do it.
RBS
_____
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Si Carter
Sent: 30 September 2008 17:40
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] What programming languages and toolkits do
you use to access Firebird?
Perhaps something like the following would work for you
-- This wil only work on tables that have a primary key.
UPDATE RDB$INDICES SET RDB$STATISTICS = -1;
COMMIT;
/* Display table names and record counts */
SELECT RDB$RELATIONS.RDB$RELATION_NAME,
CASE WHEN RDB$INDICES.RDB$STATISTICS = 0 THEN 0 ELSE
CAST(1 / RDB$INDICES.RDB$STATISTICS AS INTEGER) END
FROM RDB$RELATIONS
LEFT JOIN RDB$RELATION_CONSTRAINTS ON
RDB$RELATIONS.RDB$RELATION_NAME =
RDB$RELATION_CONSTRAINTS.RDB$RELATION_NAME
AND RDB$CONSTRAINT_TYPE = 'PRIMARY KEY'
LEFT JOIN RDB$INDICES ON
RDB$RELATION_CONSTRAINTS.RDB$INDEX_NAME = RDB$INDICES.RDB$INDEX_NAME
WHERE RDB$VIEW_BLR IS NULL AND
RDB$RELATION_ID >= 128
ORDER BY 1;
its not 100% accurate but might be what your looking for
rgds
Si
On Tue, Sep 30, 2008 at 5:14 PM, <bartsmissaert@
<mailto:bartsmissaert%40blueyonder.co.uk> blueyonder.co.uk> wrote:
>> I wonder if you know that the X table[Non-text portions of this message have been removed]
>> have 6349865 records make you more happy!
>
> It would help me.
>
> RBS