|
Home > Archive > MS SQL Server > December 2006 > Indexing of binary and varbinary
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Indexing of binary and varbinary
|
|
| Kjell Arne Johansen 2006-12-13, 7:12 pm |
| Hi
I’m writing an Alarms and Events database. Our A&E is identified by a byte
array in the A&E object. This byte array I will store in a column of a table
in addition to other columns with other relevant data.
I’m thinking of using the binary or varbinary type for the purpose of
storing the byte array.
I also need to have an index on the varbinary field, -is that possible?
This field will identify an instance of a specific alarm and will be used to
calculate statistics regarding how often the alarm occurs etc.
Is possible to do SELECT on a varbinary, and if so is it more resource
demanding compared to do this with a string on the same size? (Another
possibility is to convert the byte array to a hex string).
SELECT BinId FROM Events WHERE BinId like @IdFromEvent
ORDER BY BinId
Regards
Kjell Arne
| |
| John Bell 2006-12-13, 7:12 pm |
| Hi
You can index varbinary columns, but if you are going to always divide this
into individual bytes and want to mainly access these separately then you
would probably be better off holding them separately, expecially if you want
to index them separately. If the bytes represent characters then you should
hold them in char columns if they are numeric or binary they should be
numeric or binary.
HTH
John
"Kjell Arne Johansen" wrote:
> Hi
>
> I’m writing an Alarms and Events database. Our A&E is identified by a byte
> array in the A&E object. This byte array I will store in a column of a table
> in addition to other columns with other relevant data.
>
> I’m thinking of using the binary or varbinary type for the purpose of
> storing the byte array.
>
> I also need to have an index on the varbinary field, -is that possible?
>
> This field will identify an instance of a specific alarm and will be used to
> calculate statistics regarding how often the alarm occurs etc.
>
> Is possible to do SELECT on a varbinary, and if so is it more resource
> demanding compared to do this with a string on the same size? (Another
> possibility is to convert the byte array to a hex string).
>
> SELECT BinId FROM Events WHERE BinId like @IdFromEvent
> ORDER BY BinId
>
> Regards
> Kjell Arne
|
|
|
|
|