Subject | Re: [ib-support] Re: Exists versus select first |
---|---|
Author | Marcos Vinicius |
Post date | 2002-03-21T17:24:49Z |
Tanks Ann and Andrew. By the way, speak about keys make I remember another question: Integers PKs are faster that varchar PKs? Same to indexes?
Dufloth.
Dufloth.
----- Original Message -----
From: csswa
To: ib-support@yahoogroups.com
Sent: Thursday, March 21, 2002 2:03 PM
Subject: [ib-support] Re: Exists versus select first
> >What I'd like to know: is it any quicker to use rdb$db_key as the
> >SELECTed field instead of * or another individual field ?? Claudio
> >has shown how rdb$db_key can be used to speed certain operations...
> >just wondering if it works in this minor case too.
>
> I don't think it would make any difference and might cause problems
> if you were checking on a view. Tables have eight byte dbkeys.
> Views have eight bytes per input stream. Anyway, a stylistic thing
Ah yes, I hadn't figured on views... I think I'll stick to using
dbkeys the accepted ways.
> that I tend to do with sub-selects that are intended to determine
> the existence of something is this:
>
> if exists (select 1 from <table> where <whatever>)
>
> The select 1 reminds me that I'm not doing useful work.
Very neat! I'm going to use a 'Y', though, as a kind of boolean
reminder. Plus it knocks another byte off, doesn't it? -- returns
one-byte char instead of two-byte smallint? Either way, an
improvement on dbkey's eight bytes. Thanks, Ann.
Regards,
Andrew Ferguson
Yahoo! Groups Sponsor
ADVERTISEMENT
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]