dbTalk Databases Forums  

How wasteful is READV... WRITEV...?

comp.databases.pick comp.databases.pick


Discuss How wasteful is READV... WRITEV...? in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
RJ
 
Posts: n/a

Default Re: How wasteful is READV... WRITEV...? - 01-27-2010 , 05:30 PM






Maybe I'm missing something. If you don't have the Item Id how would you
perform Readv without giving an Item Id?. If you want just the Item Id
then Readnext ID Else seems the easy way. Seems like a Catch 22.
BobJ

"Tony Gravagno" <address.is.in.posts (AT) removethis (DOT) com.invalid> wrote in
message news:qbb1m5p0sf2ab631f5h3mrcr9o6m06fovh (AT) 4ax (DOT) com...
Quote:
"Ed Sheehan" wrote:
Do all platforms support READV of attr 0? I'm thinking D3 doesn't, or at
least didn't.

And as far as limiting memory usage by reading attr 0, I believe the
entire
record is always read into memory, and just the requested attribute is
copied into process workspace. Maybe it's just a slight improvement after
all.

D3 does not support READV/0.

I hope I have this right - I'll defer to someone with a clue...

We need to separate the concept of memory and workspace here.

If you have large items then READV/WRITEV prevent reading the entire
buffer into BASIC workspace. When this happens with a whole item,
BASIC is going to suck in as many frames as it needs to hold the
variable. If you're working with FlashBASIC then this is all done in
memory. But at the DBMS level, all of the data needs to be pulled
from disk into memory anyway (not BASIC workspace) so that it can be
scanned for attribute marks. So while you save something in post-read
frame manipulation, you gain nothing in disk IO access time.

With WRITEV, a smarter MV system will not read the item into workspace
before the update, it will count the number of bytes in the current
attribute on disk and replace the attribute in-line if it matches the
number of new bytes. If the byte count is different then the DBMS
needs to shift frames up or down, pretty much negating the imagined
economy of a WRITEV. Every platform does this differently.

HTH
T

Reply With Quote
  #12  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: How wasteful is READV... WRITEV...? - 01-28-2010 , 03:11 AM






"RJ" wrote:
Quote:
Maybe I'm missing something. If you don't have the Item Id how would you
perform Readv without giving an Item Id?. If you want just the Item Id
then Readnext ID Else seems the easy way. Seems like a Catch 22.
Bob, the concept of ReadV/0 doesn't mean you're trying to get
information about the item ID. It means you're testing to see if the
item exists. See:
http://www.pickwiki.com/cgi-bin/wiki...ips_And_Tricks

It's a convention, a trick that people have coded into, but (not that
I've tried it anytime recently) I don't believe D3 supports this
trick. I know this particular trick has caused some sites difficulty
in migration - as use of many non-standard tricks will...

HTH
T

Reply With Quote
  #13  
Old   
Richard Wilson
 
Posts: n/a

Default Re: How wasteful is READV... WRITEV...? - 01-28-2010 , 09:11 AM



word of warning Revelation readv from xx,ID,0 returns the complete record

note: I havent tested other versions of MV yet.

Rich

Tony Gravagno wrote:
Quote:
"RJ" wrote:
Maybe I'm missing something. If you don't have the Item Id how would you
perform Readv without giving an Item Id?. If you want just the Item Id
then Readnext ID Else seems the easy way. Seems like a Catch 22.

Bob, the concept of ReadV/0 doesn't mean you're trying to get
information about the item ID. It means you're testing to see if the
item exists. See:
http://www.pickwiki.com/cgi-bin/wiki...ips_And_Tricks

It's a convention, a trick that people have coded into, but (not that
I've tried it anytime recently) I don't believe D3 supports this
trick. I know this particular trick has caused some sites difficulty
in migration - as use of many non-standard tricks will...

HTH
T

Reply With Quote
  #14  
Old   
frosty
 
Posts: n/a

Default READV from Attribute Zero (was: How wasteful is READV... WRITEV...?) - 01-28-2010 , 12:43 PM



Richard Wilson warned:
Quote:
word of warning Revelation readv from xx,ID,0 returns the complete record

note: I havent tested other versions of MV yet.

Rich
I'm on uniData.

Since translate through attribute 0 returns the
entire record, I suspected that READV would, too.

Here's my test program, GBP TEST:

OPEN 'GBP' TO FV ELSE STOP 201,'GBP'
READV GOO FROM FV,'TEST',0 ELSE GOO = 'NO CAN READV'
CRT CHANGE(GOO,@AM,CHAR(13):CHAR(10))

Anybody wanna guess what the output of this
program might be?




spoiler... answer below...








It produces "1" (without the quotes.)

Maybe it's returning a Boolean?!?

--
frosty

Reply With Quote
  #15  
Old   
Bob Dubery
 
Posts: n/a

Default Re: READV from Attribute Zero (was: How wasteful is READV...WRITEV...?) - 01-28-2010 , 03:07 PM



On Jan 28, 7:43*pm, "frosty" <fros... (AT) bogus (DOT) tld> wrote:

Quote:
Here's my test program, GBP TEST:

OPEN 'GBP' TO FV ELSE STOP 201,'GBP'
READV GOO FROM FV,'TEST',0 ELSE GOO = 'NO CAN READV'
CRT CHANGE(GOO,@AM,CHAR(13):CHAR(10))

Anybody wanna guess what the output of this
program might be?

spoiler... answer below...

It produces "1" (without the quotes.)

Maybe it's returning a Boolean?!?
Maybe it's returning the status bit (success/no success) from the
CHANGE statement.

Reply With Quote
  #16  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: READV from Attribute Zero (was: How wasteful is READV... WRITEV...?) - 01-28-2010 , 04:29 PM



This is why it shouldn't be used - you won't get a compile-time error
when you migrate - the behaviour of your application will change.
Nasty stuff.

Reply With Quote
  #17  
Old   
Ross Ferris
 
Posts: n/a

Default Re: How wasteful is READV... WRITEV...? - 01-28-2010 , 11:27 PM



Why not write a little test process and test yourself??? Wouldn't take
much, and if you were REALLY so inclined, could also then look at the
impact or poorly sized files, as well as different file types (dynamic
springs to mind)

You will then have MEANINGFUL data for YOUR environment .... all for
little more than it took to write your email, and much less time than
it will take me to read the thread :-)

Reply With Quote
  #18  
Old   
Peter McMurray
 
Posts: n/a

Default Re: How wasteful is READV... WRITEV...? - 01-29-2010 , 03:36 AM



Hi
I am fascinated by the incredible number of opinions expressed here on a
totally pointless subject.
It is ridiculous to ever use writev or readv as it leads to chaos.
The simple rule to follow is always dimension all items as an array and
always equate every element of the array to a standard variable then always
refer to all variables by name.
Simple bug free and obvious.
Obviously one sets up a schema for each item and includes it into each
program requiring the record. Then when a file changes as they do over time
it matters not if address1 is now attribute 13 when it was previously
attribute 7
Peter McMurray

"Ross Ferris" <rossf (AT) stamina (DOT) com.au> wrote

Quote:
Why not write a little test process and test yourself??? Wouldn't take
much, and if you were REALLY so inclined, could also then look at the
impact or poorly sized files, as well as different file types (dynamic
springs to mind)

You will then have MEANINGFUL data for YOUR environment .... all for
little more than it took to write your email, and much less time than
it will take me to read the thread :-)

Reply With Quote
  #19  
Old   
Martin Phillips
 
Posts: n/a

Default Re: READV from Attribute Zero (was: How wasteful is READV...WRITEV...?) - 01-29-2010 , 06:57 AM



Quote:
Since translate through attribute 0 returns the
entire record, I suspected that READV would, too.

OPEN 'GBP' TO FV ELSE STOP 201,'GBP'
READV GOO FROM FV,'TEST',0 ELSE GOO = 'NO CAN READV'
CRT CHANGE(GOO,@AM,CHAR(13):CHAR(10))

Anybody wanna guess what the output of this
program might be?
It depends on what system you are using. If READV doesn't recognise
field zero as being something special, it is likely to return the
entire record (as in Revelation).

UniVerse takes the THEN clause and returns the record id if the record
exists, and takes the ELSE clause and returns a null string if it
doesn't exist.

Unidata appears to return 1 or 0 as the "record" read though their
documentation isn't too clear on what is supposed to happen.

QM behaves like UniVerse though I notice that our documentation
doesn't quite match with this. It will be fixed.

Ultimately, READV fields 0 is implementation specific but, in all
systems that support it, it allows a program to determine whether a
record exists. I cannot say what happens in other systems but QM
certainly does not read the record into memory for this operation,
providing significant performance advantages over a READ when the
record is huge. A quick experiment with an 80Mb record in UniVerse
suggests it does the same.


Martin Phillips, Ladybridge Systems

Reply With Quote
  #20  
Old   
Douglas Tatelman
 
Posts: n/a

Default Re: How wasteful is READV... WRITEV...? - 01-29-2010 , 09:54 AM



I'm not sure I agree with this simple rule. I've really learned to
love dynamic arrays over the years.

Nothing worse than modifying an old system and having to change the
DIM statements all over the place.

You can still do equates if you wish.


Quote:
The simple rule to follow is always dimension all items as an array and
always equate every element of the array to a standard variable then
always
refer to all variables by name.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.