Subject | Re: Exists versus select first |
---|---|
Author | csswa |
Post date | 2002-03-21T17:03:05Z |
> >What I'd like to know: is it any quicker to use rdb$db_key as theAh yes, I hadn't figured on views... I think I'll stick to using
> >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
dbkeys the accepted ways.
> that I tend to do with sub-selects that are intended to determineVery neat! I'm going to use a 'Y', though, as a kind of boolean
> 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.
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