jemz — 2013-08-25T18:11:35-04:00 — #1
Hi, I just want to ask ,...How would you perform your search query if you have millions of data in your database...is there a fastest SQL query to perform on this that can find with less time?
Thank you in advance
mittineague — 2013-08-25T19:12:06-04:00 — #2
Millions? You're talking hypothetically and don't have a specific example correct?
Depending on what you're trying to do I imagine there's always a "best" way.
First important thing is that your table architecture is optimal. eg. "normalized".
Also, don't use SELECT * explicitly specify only the fiields you need
And if you're going to get a bucket load of results try using LIMIT and OFFSET
jemz — 2013-08-25T19:31:19-04:00 — #3
Thank you for your reply I haven't tried OFFSET...
stomme_poes — 2013-08-26T04:20:16-04:00 — #4
Faster than continual SQL queries is an actual search engine: SOLR, Sphinx, ElasticSearch (built on Lucene), etc.
lemon_juice — 2013-08-26T17:12:33-04:00 — #5
Hm, I thought we de-normalize db architecture to improve performance, not the other way round?
r937 — 2013-08-26T18:40:13-04:00 — #6
we normalize to eliminate redundancies, prevent errors, avoid inconsistencies, and ensure data integrity
dude, never skip that step, okay?
lemon_juice — 2013-08-26T20:10:22-04:00 — #7
Yep, but the subject is about performance not data integrity. After we got it (integrity) we may find out that some normalizations bite performance too much so we sacrifice some of them to keep the system fast. Isn't that right? I wrote de-normalize, not normalize in my previous post :).
jemz — 2013-08-27T17:29:42-04:00 — #8
Hi to all experts,....Can i rephrase my words,...what i want is to search a certain word or string with in database which have millions of data.so how would you guys perform the search query,which is efficient and faster to get the result.
Thank you in advance, Hope this helps
stomme_poes — 2013-08-30T14:34:10-04:00 — #9
Full text search and m0aR
or focus simply on full-text search
or if already using an awesome database, search may be built right in
You get queries with filters, fuzzy matching, stemming, and with ES possibly a standalone document store+ if that's all hip and trendy with the kids these days. I have seen ES churn through gazillions of data and it's fast. Eats memory like alzheimers, but fast.
Okay I'm assuming jemz just wants to know an example query but you'd thing that depended heavily on the data, structure and what you're searching for.