I am optimizing the search query in the Postgres database. The query uses the unaccent function. I want to create a gin-index to make the search query faster. So I had gone through some articles on faking the stable function as an immutable function using wrapper functions. I was thinking of creating a new column for precomputed unaccented texts would be good. But I got to know that the unaccent function can produce different outputs. So what is the preferred way? Precomputation or using a wrapper function to deceive the program?
Why unaccent function in Postgres is a stable function? Will the precomputation in column produce the different outputs?
260 Views Asked by Krunal Goswami At
1
There are 1 best solutions below
Related Questions in POSTGRESQL
- Why does adding a JOIN completely modify the query planner behaviour?
- When dealing with databases, does adding a different table when we can use a simple hash a good thing?
- Aggregate and count in PostgreSQL
- Rails HABTM: Select everything a that a record 'has'
- Trigger using data from inserted row
- Select results where joined table contains records with an attribute, but without another
- DB candidate as CouchDB/Schema replacement
- How do I properly add data in SQLAlchemy?
- Postgres in Conda Environment (Ubuntu 14.04)
- How to customize the output of the Postgres Pseudo Encrypt function?
- Split a large query (2 days) into pieces to increase the speed in Postgres
- Why does pg_search prefix not work like I expect?
- extracting meta info from a table psql using information_schema
- How to query a table in the database and copy it's data into one one?
- Update a table using info from a second table and a condition from a third table in Postgresql
Related Questions in INDEXING
- Why does mysql stop using indexes when date ranges are added to the query?
- MySQL: Using natural primary index or adding surrogate when tables are given
- How does MongoDB process unsupported languages?
- Error in indicies while unsetting Sessions
- How to index a field with mongodb-erlang
- How to force use of indices in MongoDB?
- Hint indexes to mysql on Join
- Lucene get all non deleted document from index file
- Querydsl generated sql query wrong sql type (nvarchar instead of varchar)
- Numpy Indexing: Get every second coloumn for each even row
- Simpler, safer string manipulation Python
- Understanding "ValueError: need more than 1 value to unpack" w/without enumerate()
- Poor performance with mongo array index
- Is it possible to skip IndexRebuilder in the startup process of mongodb 2.6?
- Does PostgreSQL self join ignore indexes?
Related Questions in QUERY-OPTIMIZATION
- Why does mysql stop using indexes when date ranges are added to the query?
- How to make faster queries on my mysql table?
- MySQL: Grouped by hour, need to show all hours, null where no data
- How can i optimize this query on a big database tables having million rows
- SQL alternative to double subquery
- Make multi-subselect more efficient?
- Efficient way to get last record from the database
- Optimising codeigniter query, Join or Where
- DB Engine Tuning Advisor suggestion improvement
- OVER() vs Two Queries - Which is Most Efficient
- Optimize the execution of select
- Optimizing MySQL InnoDB insert through PHP
- Ruby on Rails - Are transactions working with nested objects?
- mysql select an average from order by with a query
- rewrite query to remove inner query in tsql to optimize
Related Questions in PSQL
- Postgresql trimming string up to the first digit
- PSQL Error Level in Batch For Loop
- How to violate duplicate key constraint (Unique_Violation) when updating reference table in PostgreSQL?
- psql max group by just for some columns
- PostgreSQL: MD5 Authentication in pg_hba.conf gives me FATAL: Peer authentication failed for user "postgres"
- psql TypeError: not all arguments converted during string formatting
- How do I make Postgres extension available to non superuser
- DEADLOCK Situation - SQL/Hibernate/Java how to resolve it?
- Rails - Simple Form with Nested Attributes
- FATAL: invalid value for parameter "TimeZone": "Australia/Canberra"
- Rails - PSQL command line query
- How do I dump a database from online server (heroku) to my local environment?
- Using psql options in npgsql
- python 2.6 subprocess enter psql password C shell
- pg_stat_statements enabled, but the table does not exist
Related Questions in UNACCENT
- Alternatives to `asciifolding` filter for removing Greek ascents from unicode text
- "UndefinedFunction: function unaccent_schema.unaccent(unknown, text) does not exist" while run any restored database in odoo
- Use unaccent postgres extension in Knex.js Querys
- Using unaccent with two different rules
- Using unaccent in tsvector trigger
- Store custom files on heroku postgres database
- Unaccent() function alternative in TEIID
- Error when creating unaccent extension on PostgreSQL
- How to make diacritics insensitive queries in PostgreSQL, without unaccent extension?
- Grails / Gorm and Postgresql Unaccent
- unaccent() does not work with Greek letters in plpgsql dynamic query
- Wildcard characters and unaccent in pg-promise query
- Unaccent extension of Postgresql 9.1 returning empty row
- Why unaccent function in Postgres is a stable function? Will the precomputation in column produce the different outputs?
- Postgres unaccent function for character
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You can read this Postgres doc about unaccent extension, in my opinion, there are two cases :
1- Add slug columns to tables :
Pros :
Cons :
Redundant data, almost if you need to implement multi-criteria searching, in this case you should create a slug(without diacritic signs) for all concerned columns
Update columns mean update all concerned slug columns
Create data migrations for the existing database with automated slug creation using Slugify for instance.
2- Use unaccent extension
Pros :
Cons :