On Wed, Mar 6, 2013 at 3:29 PM, Petite Abeille <petite.abei...@gmail.com> wrote:
> On Mar 6, 2013, at 10:24 PM, Nico Williams <n...@cryptonector.com> wrote:
>> CREATE TABLE toy(a INTEGER CHECK(a = CAST(a AS INTEGER)));
>
> Any idea on the cost of such check? In term of overhead? Just curious.

Well, it's more than the cost of no check constraint.  Here's the
additional opcodes generated in my case:

5|SCopy|2|3|0||00|
6|ToInt|3|0|0||00|
7|Eq|3|9|2|collseq(BINARY)|6b|
8|Halt|19|2|0||00|

Of these the expensive one will be ToInt, though maybe SCopy too.
Dunno how expensive.

Note that the typeof() check constraint generates one more opcode:

5|Copy|2|4|0||00|
6|Function|0|4|3|typeof(1)|01|
7|String8|0|5|0|integer|00|
8|Eq|5|10|3||6a|
9|Halt|19|2|0||00|

Nico
--
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to