in reply to Re^4: Matching alphabetic diacritics with Perl and Postgresql
in thread Matching alphabetic diacritics with Perl and Postgresql
I see. I'll just add my 2 cents for your perusal.
Batch processing with loaded data is almost always better in the database simply because it is made for it. It ends up being faster because systems are not switched, the database can do things in batches (as opposed to line by line) and character issues are unlikely to be coming up. So, before you even start, you're already ahead.
I'm relatively sure you can do it a few statements too, if done correctly. I have done things like this before, and on one job, i created a batch table to make record (and time) the different steps, allowing multiple batches to be done at the same time (because the steps do not have anything to do with the batches, per se).
If there are common misspellings, i would likely use a translation table to change misspellings to the used spelling, or move a country to the next step. A small query would do that (perhaps as part of a larger query). Anything not found would be flagged for human perusal, which would happen less and less with each run. Having the translation table in the database is likely better for managing it anyway, and you can even keep fun numbers like how often each shows up.
To remove spaces and new lines, postgres has replace functions, including regex. That's one very simple query.
In my experience, the sql code is smaller, not larger, if written correctly. However, if you already have it written in perl, there's no reason to reinvent the wheel, unless a large problem comes up, or you want/need processing to take (what might be) a fraction of the time.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Matching alphabetic diacritics with Perl and Postgresql
by marinersk (Priest) on Jun 04, 2017 at 10:19 UTC | |
|
Re^6: Matching alphabetic diacritics with Perl and Postgresql
by anonymized user 468275 (Curate) on Jun 04, 2017 at 11:18 UTC | |
by chacham (Prior) on Jun 04, 2017 at 20:39 UTC | |
by anonymized user 468275 (Curate) on Jun 05, 2017 at 14:12 UTC | |
by chacham (Prior) on Jun 05, 2017 at 20:22 UTC |