본문 바로가기

카테고리 없음

graph database and pointer (structure)

RDB 에 비해 왜 관계에 대해 그래프가 훨씬 빠를 수 있는가에 대해 직접적인 내용을 다뤄주고 있는 포스팅을 가져와 봤다

 

Instead of storing additional data (the reference) in our data tables as attributes explicitly, the graph database system can store true memory pointers to the next related entity. Most graph database systems store data in a structure similar to linked lists. They store direct links to data which is connected, rather than similar objects. I’d say they are relationship-first.

 

데이터 테이블에 추가 데이터(참조)를 명시적으로 속성으로 저장하는 대신 그래프 데이터베이스 시스템은 다음 관련 엔터티에 대한 "실제 메모리 포인터"를 저장할 수 있습니다.

대부분의 그래프 데이터베이스 시스템은 "링크드 리스트"와 유사한 구조로 데이터를 저장합니다. 유사한 개체가 아닌 연결된 데이터에 대한 직접 링크를 저장합니다. 나는 그들이 관계 우선이라고 말하고 싶습니다.

 

 

https://towardsdatascience.com/at-its-core-hows-a-graph-database-different-from-a-relational-8297ca99cb8f

 

At its core: How’s a graph database different from a relational?

Beyond listing superficial benefits and implications: Let’s explore what the fundamental difference of the two is.

towardsdatascience.com

 

"A memory address is a number given by the operating system that refers to a memory location where data can be written or read.

A pointer in C and C++ is a variable that stores a memory address and also contains information of the data type that should be stored in the memory location referred by the memory address stored."

"A pointer is a variable which is used to store a memory address. It is like any other variable and it is stored at a memory location and it has memory address. But, the contents of it’s memory location is again a memory address. This is the pictorial representation."


"A pointer is also a memory address which points to another memory address and hence called POINTER. If a memory address contains data (and not another memory address), it may be called a VARIABLE or CONSTANT. However, since we can change value of a POINTER so a pointer may better be called as a POINTER VARIABLE or POINTER CONSTANT as the case may be."



"In a memory paging system the OS keeps a paging table that helps with this translation scheme. The upper 𝑛n bits of the virtual address give the page number (in the figure below, these are bits 12 - 31, a total of 20 bits, give the page number) and the lower bits give the offset, which tells us how far into the page we are. The OS maps the page number to a physical address and then adds the offset to get the physical address."

 

 

 

 

Allocation of memory: The Stack

So the C model of computation has two main places for memory to be allocated at runtime: the stack and the heap. The stack is for things known at compile time and things that may have to exist out of the scope in which it’s created. Let’s look at how the stack works.

 

 

Allocation of Memory: The Heap

The heap is another segment of virtual memory that allows for data to be allocated independently from the stack. If we, at runtime, realize that we need to grab an extra 100000 ints, we ask for it from the heap (or the freestore). In C we do this with malloc(), which negotiates with the OS and returns a pointer to the memory location. This memory persists across function calls, so if I then immediately return from a function (with a return value of the memory I just allocated) then that new memory is untouched (it’s not on the stack, so it doesn’t go away!) This is an obvious advantage, but it also has an obvious disadvantage: we need to make sure that we deallocate the memory since the stack won’t take care of it for us. If you’ve ever heard of a memory leak, this is where it comes from.



https://www.quora.com/What-is-the-difference-between-a-memory-address-and-a-pointer-in-C

 

What is the difference between a memory address and a pointer in C?

Answer (1 of 11): Memory addresses are language agnostic, and refer to a specific physical or virtual place in the system’s physical or virtual memory. They are like the street address that labels the place you live, or the place you work, or go to schoo

www.quora.com