473,795 Members | 3,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Storing file bytes in SQL Server

Hi all

I'm getting a serious performance hit when encoding bytes into hex and then
storing in SQL Server.

Any ideas? Do I have to accept that there will be a performance hit? It's
slow even when just persistent 250K images for example.

Thanks
Kev
May 31 '06 #1
3 1773
Why encode to hex? How exactly are you storing the images? Is it a text
column or a binary (image) column? (hint: it should be the latter)

See
http://www.aspfree.com/c/a/ASP.NET/U...e--C---Part-I/

Also - when reading images you can improve things by treating it as a stream
using GetBytes and sequential access. There may be a way to do this when
saving as well; I haven't had to use this (at least, not in .Net) - but I
would expect it to be there.

Marc
May 31 '06 #2
Alternative reference:
http://www.akadia.com/services/dotne...rite_blob.html

Google on "blob save c#" for more...

Marc
May 31 '06 #3

"Marc Gravell" <ma**********@g mail.com> wrote in message
news:OE******** ******@TK2MSFTN GP05.phx.gbl...
Why encode to hex? How exactly are you storing the images? Is it a text
column or a binary (image) column? (hint: it should be the latter)

See
http://www.aspfree.com/c/a/ASP.NET/U...e--C---Part-I/

Also - when reading images you can improve things by treating it as a
stream using GetBytes and sequential access. There may be a way to do this
when saving as well; I haven't had to use this (at least, not in .Net) -
but I would expect it to be there.


Thanks, I am using text column for other reasons, but given how it's
affecting performance we're going to switch to using image columns and
directly uploading the bytes.

Kev
May 31 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11767
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem I have is I cannot retain the primary key field in a variable which is then used in a SQL update...
2
8252
by: Tony | last post by:
Hi, I have dynamically created a PDF document in memory as a FileOutputStream Now I have to get it into a DB2 table, storing it as a BLOB. The table has a document id, document name, some date fields and this BLOB column that stores PDF Files. Until now, the PDF files were read off of a disk drive. The code used was: byte fileAsBytes = (byte) adminDocEvent.getFile(); which returns an object.
14
5850
by: Luiz Antonio Gomes Pican?o | last post by:
How i can store a variable length data in file ? I want to do it using pure C, without existing databases. I'm thinking to use pages to store data. Anyone has idea for the file format ? I want to store data like a database: ---------------------------------- Custumer:
1
1882
by: Al | last post by:
Hi, I need to store literally thousands if images and scanned document in the Database. I would like to know what is the most efficient algorithm both in terms of speed and storage for saving images in database (using SQL server). Currently I am using the following algorithms. Question is can I improve this? 'Get length of stream (lengt of file) in bytes InByteCount = loFile.Length() 'Reallocate storage space for an array variable to...
7
5140
by: Ian Boyd | last post by:
Customer wanted us to figure out why their database was growing at an astronomical rate. We broke down the various fields making up a table, and we found that the ..LB file was using about 1k per row, where the average length of the two combined CLOB fields in the table was 12 bytes (4 bytes standard deviation). So i hex edited the .lb file and found the problem, each clob value is taking 0x400 bytes i.e. 1024 bytes.
3
1193
by: Kevin | last post by:
Anyone hashing or storing URLs for later lookup? I was curious for the best practices on storing such a wide column that needs indexing and if there were alternatives. We have a table an are anticipating millions of rows and want to look up the content through the URL, due to SQL server we have a 900 bytes restriction on the index. Would hashing be the way to go (and look up via the hash) OR just limit the URL length to 450 nvarchar (900...
6
17148
by: J055 | last post by:
Hi I have the following code. I upload an XML file using the FileUpload object, store the stream in a session so the user gets the chance to confirm some options then pass the stream from the Session to an XmlReader. if (performImport == false) { Session = fileUpload1.FileContent; //... some other code
10
2313
by: deciacco | last post by:
I'm writing a command line utility to move some files. I'm dealing with thousands of files and I was wondering if anyone had any suggestions. This is what I have currently: $arrayVirtualFile = array( 'filename'=>'filename', 'basename'=>'filename.ext', 'extension'=>'ext', 'size'=>0,
7
1932
by: pereges | last post by:
I've to store an array of structures: typedef struct { double origin; double e_field_at_origin_real, e_field_at_origin_imag; double direction; double pathlength; int depth; }ray;
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9043
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6783
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.