Re: [firebird-support] Generator Performance
On 26/09/11 17:06, Ann Harrison wrote: Is there a way of finding out how many pages are used to store a given table? Or documentation about how the mapping from tables to memory and disk pages are implemented on firebird? Maybe http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/Firebird-Internals.pdf might help, it's a work in [slow] progress though. :-( HTML version is on-line at http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/fb-internals.html. Pretty simple. If you care about detail, look at ods.h for the size of the PAG structure and the exact layout of a generator page. For a rough approximation of the number of generators on a page, divide the page size by 8. If I remember, (page-size-32)/8 gives the maximum number of sequences on a page. For a 4K page that's 507. There is also a maximum of 32,767 sequences per database. Note that this algorithm works ONLY for generators which are not normal table data. Figuring out how many data records fit on a page is an advanced exercise. http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/fbint-page-5.html might help explain the difficulties - think Run Length Encoding and NULLs etc. Cheers, Norm. -- Norman Dunbar Dunbar IT Consultants Ltd Registered address: Thorpe House 61 Richardshaw Lane Pudsey West Yorkshire United Kingdom LS28 7EL Company Number: 05132767
Re: [firebird-support] Generator Performance
Hello Matheus, Is there a way of finding out how many pages are used to store a given table? Run gstat -r, there will be exact information - Data Pages: NNN CFG (149) Primary pointer page: 2736, Index root page: 2737 Average record length: 71.20, total records: 15549 Average version length: 10.54, total versions: 48, max versions: 16 Data pages: 875, data page slots: 875, average fill: 81% If you prefer convenient GUI interface, our IBAnalyst tool can show this and other information in more friendly way and even calculate tables/indices sizes in Mb. Regards, Alexey Kovyazin IBSurgeon (www.ib-aid.com) ++ Visit http://www.firebirdsql.org and click the Resources item on the main (top) menu. Try Knowledgebase and FAQ links ! Also search the knowledgebases at http://www.ibphoenix.com ++ Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) * To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com * To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [firebird-support] Generator Performance
Hello Matheus, Generator values are stored on generator pages. In shared cache architectures (i.e. SuperServer) a connection that changes a generator value gets a transient write lock on the page, makes its change and releases the page. This page is the mapping of a set of table records into a memory/disk page, right? Right. Everything stored in the database, data, metadata, and structural data, is stored on fixed sized pages. Pages come in different types: data, blob, index, generator, page inventory, transaction inventory, header, index root, and pointer. A generator page consists of a standard page header (~20 bytes) plus an array of 64 bit integers. Every page in the database is the same size, either 4, 8, or 16Kb. So, if I had a large number of generators, for workloads which accessed generators on different pages (say, generator ID 10 and generator ID 4000) there wouldn't be contention, right? Depending on the page size, right. Is there a way of finding out how many pages are used to store a given table? Or documentation about how the mapping from tables to memory and disk pages are implemented on firebird? Pretty simple. If you care about detail, look at ods.h for the size of the PAG structure and the exact layout of a generator page. For a rough approximation of the number of generators on a page, divide the page size by 8. Note that this algorithm works ONLY for generators which are not normal table data. Figuring out how many data records fit on a page is an advanced exercise. Good luck, Ann [Non-text portions of this message have been removed]