My point was to demonstrate the property of unique indexes which prevent duplication: a safety measure. I never said to use the error for program control. In fact I didn't exhibit any DBI code at all.
In practice, with the index in place:
my $known_dep=$dbi->prepare_cached("select 1 from depends where usedby +=? and uses=?"); sub known_dep ($$) {#prototype because we have a fixed number of place +holders $known_dep->execute(@_); $known_dep->rows; # 1 or 0 for unique index. }
For frequent operations, we can improve performance with the sth->bind_params() method.
We search on an index, using a pre-prepared statement handle with placeholders. That will be fast.
I didn't mention before that NULL in multiindexes is only available in MyISAM tables.
After Compline,
Zaxo
In reply to Re: Re: Re: How to count rows using DBI & mysql - Performance results
by Zaxo
in thread How to count rows using DBI & mysql - Performance results
by Brovnik
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |