Subject | RE: [IBO] Which is faster? Select First 3000 or MaxRows = 3000 ? |
---|---|
Author | aalexander |
Post date | 2006-12-08T08:41:44Z |
Hi Jason,
We have written our own Replication application to enable our organisation
to replicate from one Master to in infinite number of Targets (usually about
4).
The Log Table is populated via Triggers on the master database and our
application retrieves this data and replicates to the target databases via a
range of stored procedures.
We have Low and High priority replication tables which are set depending
upon how important it is that the data is kept up to date. As a result we
replicate a set number of records per replication in the example given this
is 3000. The Sequence field is set the priority of the data records, and are
generated by one of two generators.
The SQL we currently use is:
SELECT ToDB, Sequence, TableName, TableID, RepType, KeyValue, Status
FROM TD_REPLICATIONLOG
WHERE TODB = 0
AND (STATUS is NULL) or (Status = "")
ORDER BY Sequence
And the Fields within the Log Table are:
FromDB
ToDB
Sequence
TableName
TableID
RepType
KeyValue
Status
I set the MaxRows Value on the query at present.
Thanks
Andrew
_____
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of Jason Wharton
Sent: 07 December 2006 22:53
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] Which is faster? Select First 3000 or MaxRows = 3000 ?
Tell us more about what you are doing. So far I'm inclined to think you are
not approaching things in the best way.
Jason
[Non-text portions of this message have been removed]
We have written our own Replication application to enable our organisation
to replicate from one Master to in infinite number of Targets (usually about
4).
The Log Table is populated via Triggers on the master database and our
application retrieves this data and replicates to the target databases via a
range of stored procedures.
We have Low and High priority replication tables which are set depending
upon how important it is that the data is kept up to date. As a result we
replicate a set number of records per replication in the example given this
is 3000. The Sequence field is set the priority of the data records, and are
generated by one of two generators.
The SQL we currently use is:
SELECT ToDB, Sequence, TableName, TableID, RepType, KeyValue, Status
FROM TD_REPLICATIONLOG
WHERE TODB = 0
AND (STATUS is NULL) or (Status = "")
ORDER BY Sequence
And the Fields within the Log Table are:
FromDB
ToDB
Sequence
TableName
TableID
RepType
KeyValue
Status
I set the MaxRows Value on the query at present.
Thanks
Andrew
_____
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of Jason Wharton
Sent: 07 December 2006 22:53
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] Which is faster? Select First 3000 or MaxRows = 3000 ?
> I have a table containing just 8 fields, however there may be uptoIt highly depends on what you are doing in the where clause.
> several million data records within this table.
>
> I need to bring the record set back in batches of approx 3000 records.
>
> I'm using an IB_Query and was hoping someone could advise if it is
> quicker/more efficient to use the following SQL statement or set the
> MaxRows property on the query.
>
> Select First 3000 * From MYTABLENAME
> WHERE ......
Tell us more about what you are doing. So far I'm inclined to think you are
not approaching things in the best way.
Jason
[Non-text portions of this message have been removed]