FirebirdSQL / NETProvider

Firebird ADO.NET Data Provider
https://firebirdsql.org/en/net-provider/
Other
161 stars 66 forks source link

Interpretation of of FbDatabaseInfo values for BlackbirdSql SqlEditor port. #1157

Open BlackbirdSQL opened 9 months ago

BlackbirdSQL commented 9 months ago

Hi, This is not an issue but not sure where else to ask this. Hope you can help.

I have been struggling to make sense of some of the values returned from FbDatabaseInfo which I am using in the BlackbirdSql DDEX extension's SqlEditor port.

  1. If you look at the snapshot trials the GetReadIdxCount() and GetReadSeqCount() values are returning huge numbers even after the cumulative values have been subtracted (see attached). Could you tell me what these values represent?
  2. GetReads() consistently returns zero. Am I missing a trick here?
  3. Is there some way of extracting the Server Execution Time of a query?

The extension is already released but I would like to jack up the stats reporting so that they're more useful.

Appreciate if you could help me out here. Thanks. Greg

FirebirdSqlEditorStatistics

cincuranet commented 9 months ago

1 & 2> Yeah. Looks like these methods are returning complete garbage. I guess, I'm parsing the response back incorrectly. I'll check and fix it. 3> I don't know from top of my head. But you can maybe check the isc_info_xxx or fb_info_xxx in Firebird sources whether something looks "suspicious". And if so, let me know and I'll add it.

BlackbirdSQL commented 9 months ago

Thanks Jiri,

I have had a look through the isc codes but there's nothing that would return a server execution time. There was something elsewhere that returned a long that implied user server stats, and that I spent some time trying to decipher. Now I can't find it. I'll get back to you when I do.

Microsoft SqlServer does include "request cost" in it's SqlEditor stats. I see there is an isc code "isc_info_request_cost". It would be great if you could include that when you have some time.

Regards, Greg

BlackbirdSQL commented 6 months ago

Okay so the majority of the isc codes return a struct with an array of value pairs. I am using Reflection atm to access the Version10.GdsDatabase::DatabaseInfo() method to get to the response buffer. The structure of the buffer is as follows:

Byte 0 contains the isc code.

Bytes 1 and 2 contain the 16 bit UInt16 byte size of the value pairs array.

Following that is the value pairs array.

Each value pair consists of a 6 byte block as follows: The first 2 bytes are the 16 bit UInt16 ID of the affected/applicable table. The next 4 bytes are the 32 bit UInt32 value pertaining to the table for the isc code.

This means that the total number of value pairs is the byte size of the array / 6.

If you could expose the DatabaseInfo() method in FbDatabaseInfo with a public access modifier that would be helpful.

Cheers, Greg

cincuranet commented 6 months ago

Instead of exposing GetDatabaseInfo (I assume you're really talking about this one) it makes more sense to me to have an implementation of that call and parsing/processing in FbDatabaseInfo. Feel free to create PR with the implementation.

BlackbirdSQL commented 6 months ago

Yeah yeah that's what I meant.