db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bergquist, Brett" <BBergqu...@canoga.com>
Subject What is the fastest query to check for an existence of a row
Date Wed, 25 May 2016 21:12:22 GMT
I have a table with 80,640,704 rows.   My query currently is:

SELECT
COUNT(*) AS USE_COUNT
FROM PKG_9145E_V1.COSEDDROPPROFILEDSCPTABLEBUNDLE_COSEDDROPPROFILEDSCPTABLEENTRY CBCE
WHERE CBCE.COSEDDROPPROFILEDSCPTABLEENTRY_ID = 768
AND CBCE.COSEDDROPPROFILEDSCPTABLEBUNDLE_ID != 2

This query is going to return a count of 78,569.

What I really want to know is if there is any row that satisfies the condition.   I have logic
that needs to run if there is such a row.   So is there a more efficient query in Derby that
will short circuit when it find a row?

Thanks

Brett

________________________________
Canoga Perkins
20600 Prairie Street
Chatsworth, CA 91311
(818) 718-6300

This e-mail and any attached document(s) is confidential and is intended only for the review
of the party to whom it is addressed. If you have received this transmission in error, please
notify the sender immediately and discard the original message and any attachment(s).

Mime
View raw message