Click here to Skip to main content
15,886,963 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Question on performance... Pin
Marc Clifton17-Oct-22 5:43
mvaMarc Clifton17-Oct-22 5:43 
AnswerRe: Question on performance... Pin
raddevus16-Oct-22 5:13
mvaraddevus16-Oct-22 5:13 
GeneralRe: Question on performance... Pin
Sander Rossel16-Oct-22 8:20
professionalSander Rossel16-Oct-22 8:20 
AnswerRe: Question on performance... Pin
abmv16-Oct-22 5:19
professionalabmv16-Oct-22 5:19 
AnswerRe: Question on performance... Pin
Cpichols17-Oct-22 1:32
Cpichols17-Oct-22 1:32 
AnswerRe: Question on performance... Pin
charlieg17-Oct-22 2:27
charlieg17-Oct-22 2:27 
AnswerRe: Question on performance... Pin
MikeCO1017-Oct-22 3:03
MikeCO1017-Oct-22 3:03 
AnswerRe: Question on performance... Pin
Max Santos17-Oct-22 3:47
Max Santos17-Oct-22 3:47 
I would implement a tmp table with a twist: diff

I would create a table, lets call it "ImportData" with 3 columns:
ID: i assume there is a field on the CSV that is unique
Data: the complete CVS line
Status: a importa status depending on the operation
I like char instead of int with "magical numbers" for these kinds os status
A single char will not hurt performance


Then:
1: Set the status to '?' before importing
2: Import to this table row by row
3: Have a SQL trigger that compares the value of column 'Data'
If it changed, set Status to 'U' (Updated) if did not change set status to 'N' (NOP, No operation)
4: At the end, set all rows with '?' to 'D' (Deleted), these are the rows not present on the CSV
5: Process all rows with status different from 'N' (the changed ones)
If 'U', insert or update on main table, if 'D' delete from main table

This will give you a differential update with only the changed rows being updated in your Main data table.
Will also give you a 'snapshot' of all data received in the last CSV file. Very useful for debug

I have several imports done this way, usually imports are very fast since (in my case) most CSV rows do not change.

If the import data is XML, o JSON you can do the same by saving the XML node or JSON node on the 'Data' column.

AnswerRe: Question on performance... Pin
GuyThiebaut17-Oct-22 5:54
professionalGuyThiebaut17-Oct-22 5:54 
AnswerRe: Question on performance... Pin
WildlingCoder17-Oct-22 6:38
professionalWildlingCoder17-Oct-22 6:38 
AnswerRe: Question on performance... Pin
JasonSQ17-Oct-22 8:44
JasonSQ17-Oct-22 8:44 
AnswerRe: Question on performance... Pin
englebart17-Oct-22 17:02
professionalenglebart17-Oct-22 17:02 
Generalworldle 267 Pin
jmaida15-Oct-22 8:59
jmaida15-Oct-22 8:59 
GeneralWordle 484 Pin
Vivi Chellappa15-Oct-22 8:41
professionalVivi Chellappa15-Oct-22 8:41 
GeneralRe: Wordle 484 Pin
Peter_in_278015-Oct-22 11:27
professionalPeter_in_278015-Oct-22 11:27 
GeneralRe: Wordle 484 3/6 Pin
jmaida16-Oct-22 12:33
jmaida16-Oct-22 12:33 
GeneralRe: Wordle 484 Pin
StarNamer@work15-Oct-22 13:21
professionalStarNamer@work15-Oct-22 13:21 
GeneralRe: Wordle 484 Pin
Amarnath S15-Oct-22 14:19
professionalAmarnath S15-Oct-22 14:19 
GeneralRe: Wordle 484 Pin
megaadam15-Oct-22 15:51
professionalmegaadam15-Oct-22 15:51 
GeneralRe: Wordle 484 Pin
OriginalGriff15-Oct-22 18:44
mveOriginalGriff15-Oct-22 18:44 
GeneralRe: Wordle 484 Pin
Sandeep Mewara15-Oct-22 19:16
mveSandeep Mewara15-Oct-22 19:16 
GeneralRe: Wordle 484 Pin
Sander Rossel15-Oct-22 20:28
professionalSander Rossel15-Oct-22 20:28 
GeneralRe: Wordle 484 Pin
pkfox16-Oct-22 4:59
professionalpkfox16-Oct-22 4:59 
GeneralI'm failing terrible on this... Pin
0x01AA15-Oct-22 8:07
mve0x01AA15-Oct-22 8:07 
GeneralThe adjective for metal is metallic... Pin
Sander Rossel15-Oct-22 2:50
professionalSander Rossel15-Oct-22 2:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.