Difference between revisions of "Tips for large databases"

From Gramps
(copyedit, wikilinks and image)
 
(45 intermediate revisions by 12 users not shown)
Line 1: Line 1:
Large data files, what to do, and what not to do.
+
{{man tip|The advice on this page was for older versions of Gramps so may not work for you. Please update as needed.}}
 +
{{stub}}<!--check accuracy  / Incorporate "Import tested with the GRANDMA Mennonite database of 1.4 million people. by user on reddit!! https://www.reddit.com/r/gramps/comments/dzevcl/database_size_limit_for_gramps/fb6hdbj/ " -->
 +
 
 +
Large family tree data files, what to do, and what not to do.
  
 
==Loading the file==
 
==Loading the file==
[[Image:EditPreferencesGeneral226.png|thumb|General tab of Edit->Preferences dialog box]]
 
For small files, you can work on GEDCOM or GRAMPS XML format. This works great.
 
However, these formats are completely loaded in your computer memory so, for larger files, this becomes slow and might bring your computer to a standstill.
 
  
Therefore, you should only handle large files by using the GRAMPS GRDB format. You do this by creating a new GRDB file and importing the large file into it. This can take a long time, so do it in the evenings! If you '''enable database transactions''' in the  Edit->Preferences->General menu tab, the importing of data will then be much faster.
+
===BSDDB backend===
<br clear="all">
+
{{man note|Should work for BSDDB versions of Gramps version 5.1.x and earlier|}}
 +
Initial import of a large (100,000+) database from either Gramps XML formats or GEDCOM can take a few hours. You will need to adjust the number of allowable locks. For 140,000 people you should use:
 +
* ''max_locks'' 300000
 +
* ''max_objects'' 300000
 +
 
 +
The easiest way to do this is to:
 +
# create a new Family Tree
 +
# exit Gramps
 +
# add a '''<code>DB_CONFIG</code>''' file to the database directory before importing (see '''<code>gramps -l</code>''' output for the directory of a specific family tree.)
 +
 
 +
Contents of this DB_CONFIG file should be:
 +
#may want to fiddle with cachesize also
 +
#set_cachesize 0 200000000 2
 +
set_lk_max_locks 300000
 +
set_lk_max_objects 300000
 +
 
 +
===SQLite backend===
 +
 
 +
Insert following line after the connect statement at line 103 in the [https://github.com/gramps-project/gramps/blob/maintenance/gramps52/gramps/plugins/db/dbapi/sqlite.py ''gramps/plugins/db/dbapi/sqlite.py''] file.
 +
 
 +
self.__connection.execute("PRAGMA cache_size = -50000")
 +
 
 +
A positive value sets the size in bytes.  A negative value sets the size in pages.  The size of a typical page is 4096 bytes.
 +
 
 +
The default value is -2000 which means 2000 pages of 4096 bytes each.
 +
 
 +
{{-}}
  
 
== Default view: bookmarks and active person ==
 
== Default view: bookmarks and active person ==
As there are many people, loading the person view might take some time. See a comparison of [[GRAMPS Performance|performance]] on large datasets, between different GRAMPS versions.
 
  
You can circumvent this load time by going to the [[Relationships screenshot|relationships view]] before opening the grdb file. This will open the active person and their family extremely fast, independent of the amount of data you gathered.
+
As there are many people, loading the person view might take some time. See a comparison of [[Gramps Performance|performance]] on large datasets, between different Gramps versions.
 +
 
 +
You can circumvent this load time by going to the [[Gramps_{{man version}}_Wiki_Manual_-_Categories#Relationships_Category|Relationships Category view]] before opening the family tree. This will open the active person and their family extremely fast, independent of the amount of data you gathered.
  
 
You can add bookmarks to common people, or in the branch you are researching. This allows to change person in the relationships view without the need to activate the person in the person view first.
 
You can add bookmarks to common people, or in the branch you are researching. This allows to change person in the relationships view without the need to activate the person in the person view first.
 +
 +
== Avoid relationship calculation ==
 +
 +
Avoid displaying relationships on the status bar. From the {{man menu|Edit > Preferences}} ''Display'' tab change the '''Status bar''' option from {{man label|Relationship to the home person}} to {{man label|Active person's name and ID}}.
 +
 +
== Avoid Gramplets ==
 +
Avoid gramplets which do a lot of database work. The '''[[Addon:Deep_Connections_Gramplet|Deep Connections]]''' Gramplet seems to be the worst case. Those type of gramplets slow everything down enormously.
  
 
== Avoid general filters ==
 
== Avoid general filters ==
 +
 
Filters search all the data looking for the people who satisfy your query. Try to avoid this on large files.
 
Filters search all the data looking for the people who satisfy your query. Try to avoid this on large files.
  
For name searches do the following:
+
{{man tip|Search letters|Fast search can be done by enabling column search (disable {{man label|Sidebar}} on {{man menu|View}} menu), but this will search all letters on words into the column, not only the first letters.}}
* click  on a person in the [[People screenshot|people view]]. Now start typing the family name of the person you need. The view will automatically go to the family name as you complete your typing.
+
 
* for a more detailed search, click ''CTRL-F'' first. This will expand all the nodes and allows to search more specifically.
+
For a surname search:
 +
* Click on a person in the [[Gramps_6.0_Wiki_Manual_-_Categories#People_Category|People Grouped Category view]]. Now start typing the family name of the person you need. The view will automatically go to the family name as you complete your typing.
 +
* For a more detailed search, use the keyboard shortcut {{man key press|CTRL|F}}. This will expand all the nodes and allows to search more specifically.
 +
 
 +
== Flat views are faster than Tree views ==
 +
 
 +
Using a large family tree database and the People grouped tree view needs to often rebuild the view especially after adding or deleting an object eg: Flat People (list) view is faster than grouped view.
  
== Please contribute ==
+
=See also=
If you have more tips for working with large databases, please share them here.
+
* [[Gramps Performance]]
 +
* [[GEPS 016: Enhancing Gramps Processing Speed]]
  
 
[[Category:Documentation]]
 
[[Category:Documentation]]

Latest revision as of 00:55, 19 July 2025

Tango-Dialog-information.png
The advice on this page was for older versions of Gramps so may not work for you. Please update as needed.

Gramps-notes.png

This article's content is incomplete or a placeholder stub.
Please update or expand this section.


Large family tree data files, what to do, and what not to do.

Loading the file

BSDDB backend

Gramps-notes.png
Should work for BSDDB versions of Gramps version 5.1.x and earlier

Initial import of a large (100,000+) database from either Gramps XML formats or GEDCOM can take a few hours. You will need to adjust the number of allowable locks. For 140,000 people you should use:

  • max_locks 300000
  • max_objects 300000

The easiest way to do this is to:

  1. create a new Family Tree
  2. exit Gramps
  3. add a DB_CONFIG file to the database directory before importing (see gramps -l output for the directory of a specific family tree.)

Contents of this DB_CONFIG file should be:

#may want to fiddle with cachesize also
#set_cachesize 0 200000000 2
set_lk_max_locks 300000
set_lk_max_objects 300000

SQLite backend

Insert following line after the connect statement at line 103 in the gramps/plugins/db/dbapi/sqlite.py file.

self.__connection.execute("PRAGMA cache_size = -50000")

A positive value sets the size in bytes. A negative value sets the size in pages. The size of a typical page is 4096 bytes.

The default value is -2000 which means 2000 pages of 4096 bytes each.


Default view: bookmarks and active person

As there are many people, loading the person view might take some time. See a comparison of performance on large datasets, between different Gramps versions.

You can circumvent this load time by going to the Relationships Category view before opening the family tree. This will open the active person and their family extremely fast, independent of the amount of data you gathered.

You can add bookmarks to common people, or in the branch you are researching. This allows to change person in the relationships view without the need to activate the person in the person view first.

Avoid relationship calculation

Avoid displaying relationships on the status bar. From the Edit > Preferences Display tab change the Status bar option from Relationship to the home person to Active person's name and ID.

Avoid Gramplets

Avoid gramplets which do a lot of database work. The Deep Connections Gramplet seems to be the worst case. Those type of gramplets slow everything down enormously.

Avoid general filters

Filters search all the data looking for the people who satisfy your query. Try to avoid this on large files.

Tango-Dialog-information.png
Search letters

Fast search can be done by enabling column search (disable Sidebar on View menu), but this will search all letters on words into the column, not only the first letters.


For a surname search:

  • Click on a person in the People Grouped Category view. Now start typing the family name of the person you need. The view will automatically go to the family name as you complete your typing.
  • For a more detailed search, use the keyboard shortcut CTRL+F. This will expand all the nodes and allows to search more specifically.

Flat views are faster than Tree views

Using a large family tree database and the People grouped tree view needs to often rebuild the view especially after adding or deleting an object eg: Flat People (list) view is faster than grouped view.

See also