Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

PSQL and SQL profiler #285

Closed
wants to merge 14 commits into from
Closed

PSQL and SQL profiler #285

wants to merge 14 commits into from

Conversation

asfernandes
Copy link
Member

No description provided.

@aafemt
Copy link
Contributor

aafemt commented Sep 27, 2020

If start_session returns session id and multiple session can be started simultaneously (according to the table RDB$PROFILE_SESSIONS), shouldn't all other procedures accept session id as a parameter to know which session to work with?

@asfernandes
Copy link
Member Author

If start_session returns session id and multiple session can be started simultaneously (according to the table RDB$PROFILE_SESSIONS), shouldn't all other procedures accept session id as a parameter to know which session to work with?

Sessions cannot be started simultaneously. Only last started session is active.

Docs says that start_session could be called with a session already started and it has the same effect as finishing the first before start the second.

@aafemt
Copy link
Contributor

aafemt commented Sep 28, 2020 via email

- `RDB$COUNTER` type `BIGINT` - Number of executed times of the statement
- `RDB$MIN_TIME` type `BIGINT` - Minimal time (in nanoseconds) of a statement execution
- `RDB$MAX_TIME` type `BIGINT` - Maximum time (in nanoseconds) of a statement execution
- `RDB$ACCUMULATED_TIME` type `BIGINT` - Accumulated execution time (in nanoseconds) of the statement
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RDB$TOTAL_TIME maybe?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RDB$TOTAL_TIME maybe?

Agree.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be MIN/MAX TIME our MINIMUM/MAXIMUM?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MIN/MAX is fine to me.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add AVG_TIME?

@asfernandes
Copy link
Member Author

In this case shouldn't RDB$PROFILE_SESSIONS also include finish time...?

Maybe... And also a description/comment passed in START_SESSION.

- Added parameter DESCRIPTION to RDB$PROFILER.START_SESSION.
- Renamed RDB$PROFILE_SESSIONS.RDB$TIMESTAMP to RDB$START_TIMESTAMP.
- Added RDB$PROFILE_SESSIONS.RDB$FINISH_TIMESTAMP.
- Renamed RDB$PROFILE_STATS.RDB$ACCUMULATED_TIME to RDB$TOTAL_TIME.
@asfernandes asfernandes changed the title PSQL profiler PSQL and SQL profiler Nov 8, 2020
Add RDB$PROFILE_SESSIONS.RDB$ATTACHMENT_ID and RDB$PROFILE_SESSIONS.RDB$USER.
…PROFILE_SESSIONS.

Disallow direct modifications in others profile tables.

Add system privilege DELETE_ANY_PROFILE_SESSION and disallow deletion of others users' data without it.

Rename procedure and parameters UPDATE_SNAPSHOT to REFRESH_SNAPSHOTS.
@asfernandes
Copy link
Member Author

asfernandes commented Sep 2, 2021

I propose change this PR creating a "profiler plugin API".

RDB$PROFILER package will still be an engine thing, but RDB$PROFILE_* tables will not.

Tables will be created (explicitly or on-demand) by the profiler plugin, and as non-system tables, will be backed-up as user tables.

RDB$PROFILER will call plugin methods. RDB$PROFILER.START_SESSION will receive list of profiler plugins and it will drive communication with them.

Engine as well will interact with profiler plugins active for the session.

I'm not yet detailing plugin API, but it will support current operations.

That will open path for real-time visual profile.

A plugin could (directly to screen in case of embedded, or via inter-process/network communication) visually display what engine is being run, instead of store things.

Plugin may also store data in different places than the database.

@livius2
Copy link

livius2 commented Sep 3, 2021 via email

@asfernandes
Copy link
Member Author

Replaced by #7086

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants