-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save parsed events into database; Design Event schema #2
Comments
Hi @gregscullard I am working on creating |
can you call the tables |
@gregscullard Sure. Will do. Thanks |
…eam, accountBalance can use the same connection object; #2
@QianSwirlds, -Overall design: Should there be self-referenced foreign keys between "otherId" and the event it refers to (and any other such relationship) ? Although this would require the NOT NULL constraint (above) to be removed so that the first event can be inserted. For example
-Is "creatorId" the ID of the parent event ? If not, is the ID of the parent event missing ? - -Timestamps in Postgres have a resolution of microseconds, if the timestamp includes nano seconds, it may be wise to split the |
@gregscullard
I just split the |
Ok, so the IDs are in fact node numbers/IDs (0,1,2,3) ? Should we name them accordingly ? |
Also, if hashes are what joins events, shouldn't they be stored in a separate table for efficiency ? A table of hashes with an ID and the ID is used in the t_events table to refer to the hash in question. |
yes, the IDs are node IDs. each node's id is the sequence of the node in the AddressBook (start from 0). I think it's ok to save node id. because when we load the nodes information from the file 0.0.102, the information we get are: nodeId, ipAddress, portno, memo (node AccountID), RSA_PubKey. if we want to search events created by a node AccountID or pubKey, we can get its nodeID from a map and then search in the database.
|
Each hash is 48 bytes I think, each hash appears twice (parent + self) so 96 bytes in total. If we stored in a separate table, we'd have 48 bytes + 8 for the bigint ID. And 2x 8 bytes for the foreign key ID in the t_events table (72 bytes). Not a huge saving, but it all counts at the speed we're storing data. |
Can we call those nodeIds "creatorNodeId" and "otherNodeId" then ? This will make more sense to someone who's not familiar with the hashgraph algorithm. |
Sure, the names ware the same as the fields name of |
Do yo mean we add a but it is possible that two different events has the same Hash, isn't it? |
I guess a hash should be unique but there is a small possibility of duplicates (maybe Leemon can comment). If the hashes are the same we have the same issue regardless, we won't be able to follow the event history (rebuild) the graph in the future from the data no ? |
Looks good, one last thing, talking to Mike Burrage, he suggested storing seconds+nanos in a single bigInt which is large enough for a few years to come. This saves us 16 bytes per row. |
No worries, I agree that splitting them is a good thing to do. |
I'm ok with the schema. Suggest we close this issue. |
Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com>
Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com>
* Initial HCS design document Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com> * Minor tweaks Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com> * Review feedback Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com> * Meeting feedback Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com> * Small tweaks Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com> * Review feedback #2 Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com> * Use reactive-grpc & split consensus service Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com> * Change realm column to realm_num Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com>
* Initial HCS design document Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com> * Minor tweaks Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com> * Review feedback Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com> * Meeting feedback Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com> * Small tweaks Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com> * Review feedback #2 Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com> * Use reactive-grpc & split consensus service Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com> * Change realm column to realm_num Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com> Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com>
- Move topic messages, contract result, file data, and live hashes from RecordFileLogger to PostgresWritingRecordParsedItemHandler - Logic for Transaction and batching will be moved together in followup Signed-off-by: Apekshit Sharma <apekshit.sharma@hedera.com>
- Move topic messages, contract result, file data, and live hashes from RecordFileLogger to PostgresWritingRecordParsedItemHandler - Logic for Transaction and batching will be moved together in followup Signed-off-by: Apekshit Sharma <apekshit.sharma@hedera.com>
- Move topic messages, contract result, file data, and live hashes from RecordFileLogger to PostgresWritingRecordParsedItemHandler - Logic for Transaction and batching will be moved together in followup Partially fixes #566 Signed-off-by: Apekshit Sharma <apekshit.sharma@hedera.com>
Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com>
Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com>
t_events Table
The text was updated successfully, but these errors were encountered: