Re: Use of large field definitions for small values



On Aug 2, 1:46 pm, David Greenberg <davi...@xxxxxxxxxx> wrote:
Hi
This is a question of "what does it cost me".

Lets say I have an integer value which would fit into a smallint field
but the field is actually defined as int or even larger as bigint.
What would that "cost" me ? How would definitions larger than I need for
the values in the field affect me ?
Its obvious that the volume of the database would grow but with the size
of resources etc that we have nowadays disc space isn't a problem like
it used to be and i/o is much faster and many people would tell me "who
cares" , or IS it a problem ?
How does it affect performance of data retrieves ? Searches ? Updates
and inserts ? How would it affect all db access if tables are pointing
at each other with foreign keys ?

Thanks !

David Greenberg

Less data can fit in a page....This will degrade performance.

Let say we have a single column table which is BigInt which you could
have declared as INT

over the period the data grown up to several hundered pages....say
10000 pages

If you could have used int instead of bigint it woluld have only
consumed 5000 pages for the same amount of data.


This is about storage. and caching

Now abt the CPU.
suppose you run a sum() on a coloumn of bigint it will require more
than twice the time of CPU as of Int. as CPU has to manupulate 8 bytes
instead of 4 bytes.


So your select will be slow,update/insert will be slow (more chances
of page split). Delete will be slow.
cache hits will be low (as low page fit on Memory).
CPU consumption will be high.
Backup/Restore would have been faster with the less pages.
That all I can think of now there may be more downsides

Hope it helps
Thanks
Shiju Samuel


.



Relevant Pages

  • [PATCH] I2C: Coding style cleanups to via686a
    ... (These conversions were contributed by Jonathan Teh Soon Yew ... int inNum) ... smooth function fit to the data will allow us to get better precision. ... - VIA register values 0-255. ...
    (Linux-Kernel)
  • Re: integral promotion., sign extension
    ... details can be found in the Standard. ... char is copied in the extra bits in the msb of the int ...i.e char=3D ... the value doesn't fit in an unsigned integer (_not_ just unsigned int, ...
    (comp.lang.c)
  • Re: best soft core(s) that have C compiler support
    ... end of FPGAs where 32 bit Cores do no longer fit. ... that many if the CPU is just part of your design. ... 3000 LUTs in the only part I can use on this board. ...
    (comp.arch.fpga)
  • Re: Flex ATX replacement mobo
    ... I can certainly find a use for the system if I fit the ITX board, ... I have a mini-ITX system with a 1GHz VIA C3 CPU and that performs easily ... You can get the 945-based intel D945GCLF2 ATOM board complete with CPU ...
    (uk.comp.homebuilt)
  • Re: Fedora Core 3, all 1.5Gb memory used, how to free it?
    ... CPU cycles. ... > process cannot fit on a top screen, then top displays what will fit, ... If you want to see ALL processes, including the idle ... ones, resize your xterm / fonts, so you can get 97 ...
    (alt.os.linux)