Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
laujerry
Creator
Creator

Optimized load using where Exists

Hi all,

I read from web resources that you can use "where exists" to do an optimized load

I have tried a simple example below but it does not perform what is expected

Can anyone point out what's wrong with it?  Thanks

//tmp:

//load * Inline [

//   id, flag

//   1, 1

//   2, 1

//   3, 1

//   4, 0

//   5, 0

//   6, 1

//   7, 0

//   8, 1

//   9, 0

//   10, 1

//];

//

//STORE tmp into tmp.QVD;

//DROP Table tmp;

flag:

LOAD

   1 as flag

AutoGenerate 1;

tmp:

load

   id

From tmp.QVD(qvd)

where exists (flag,flag);

DROP Table flag;

1 Solution

Accepted Solutions
evan_kurowski
Specialist
Specialist

Jerry Lau wrote:

Hi all,

I read from web resources that you can use "where exists" to do an optimized load

I have tried a simple example below but it does not perform what is expected

Can anyone point out what's wrong with it?  Thanks

tmp:

load

  id

From tmp.QVD(qvd)

where exists (flag,flag);

DROP Table flag;

Hello Jerry,

When I take this script segment and add the field [flag] to the statement involving exists(), I get a restoration of the optimized load message.  try:

tmp:

load id, flag

From tmp.QVD(qvd)

where exists (flag, flag)

View solution in original post

3 Replies
evan_kurowski
Specialist
Specialist

Jerry Lau wrote:

Hi all,

I read from web resources that you can use "where exists" to do an optimized load

I have tried a simple example below but it does not perform what is expected

Can anyone point out what's wrong with it?  Thanks

tmp:

load

  id

From tmp.QVD(qvd)

where exists (flag,flag);

DROP Table flag;

Hello Jerry,

When I take this script segment and add the field [flag] to the statement involving exists(), I get a restoration of the optimized load message.  try:

tmp:

load id, flag

From tmp.QVD(qvd)

where exists (flag, flag)

laujerry
Creator
Creator
Author

Hi Evan

Thanks that works

But so does that mean the field to be used for controlling optimized load must be loaded to the data?

evan_kurowski
Specialist
Specialist

Hello Jerry,

It looks that way, at least at the time the load statement is being performed.  However you can drop the EXISTS field from any tables after the import is done.

DROP field flag from tmp;