|
Melraidin posted:Is there a way to get a running total from MS SQL in the same manner as from MySQL? Or, as I suspect, is getting a running total from MySQL a bad idea to begin with? Pull the data out of the database as-is, and model the data in your application. Keeping computation out of your database makes it perform better, and promotes a looser coupling between your application and any one database platform. Just my opinion!
|
# ¿ Dec 5, 2007 21:28 |
|
|
# ¿ May 7, 2024 10:49 |
|
dest posted:I need a custom Excel SQL query written for my job. The boss wants it, and I don't know a thing about SQL. If I wanted to pay a goon to write it for me, should I post it in here somewhere, or over in SA Mart? So you need weekly sums per-vendor? That should be pretty easy to do. You might get more help if you post the relevant parts of your SQL schema though.
|
# ¿ Feb 29, 2008 03:33 |
|
LightI3ulb posted:No errors at all, and adding mcl doesn't change anything Did you connect() with RaiseError? You aren't checking that execute() succeeded. Exceptions and DBI go well together: code:
|
# ¿ Apr 8, 2008 04:17 |
|
da keebsta knicca posted:So no one has ever had a problem with MySQL and creating a fulltext index on a table and trying to use it and having MYSQL claim it is not there? although boolean mode works for some reason. Post the table schema, and the EXPLAIN output for whatever queries are not acting as expected. MySQL fulltext is quite limited, and its possible you are producing a query where the index cannot be used as you are expecting because it is mixing another index in. More than likely, your boolean mode query is not using the index either (they can complete without one, but its slow).
|
# ¿ Apr 8, 2008 04:27 |
|
da keebsta knicca posted:I have deleted a bunch of indexes and cleared everything out still no go with this simplified SQL. And how many rows of data are in the table you are running the query against? Make sure you have enough data in the table that MySQL isn't "optimizing away" your results because of the 50% rule. From here: quote:A word that matches half of the rows in a table is less likely to locate relevant documents. In fact, it most likely finds plenty of irrelevant documents. We all know this happens far too often when we are trying to find something on the Internet with a search engine. It is with this reasoning that rows containing the word are assigned a low semantic value for the particular data set in which they occur. A given word may reach the 50% threshold in one data set but not another. If you're sure you have varied data inserted, run "REPAIR TABLE `job_postings`". Then run a query with EXPLAIN and a suitably-unique word for the AGAINST clause: code:
Here's what I put in my table for the test: code:
code:
|
# ¿ Apr 9, 2008 05:08 |
|
Stabby McDamage posted:I'm using DBI with Perl against MySQL. I know Perl inside and out, but have very little database experience. The result set is being buffered by DBD::MySQL, like you said. By default, the driver uses "mysql_store_result()" to buffer the result locally. MySQL also provides "mysql_use_result()", which works more like you described, but at a possibly serious performance hit at the server (see here). Unless you're doing this on an isolated box where you're the only client, I would probably go with using LIMIT as you said. Just remember that for "LIMIT 5000, 20", the server actually reads rows 1-5000 before sending you the next twenty you actually want, so you might want a fully-indexed subquery involved that pulls the keys you need first and passes those to an outer query that gets the full row data. Server-side prepare (which is probably not on by default, depending on your DBD::MySQL version) will prepare the query on the server, so that the client needs only send the parameters for the query on each execute, rather than sending the entire block of SQL + parameters and doing the query parsing step each time. It's mostly useful for bulk write operations. To use it, you need the "mysql_server_prepare=1" option included in the DSN given to connect(), but read the docs first. Check out DBD::MySQL docs and source, and the MySQL C API docs and it demystifies a lot of things. MySQL sucks. Enjoy.
|
# ¿ Apr 12, 2008 03:35 |
|
da keebsta knicca posted:Ack... thanks. Requires me to have meetings with 2 different people to discuss possible implications site wide and all this junk. It won't affect the data at all, just what characters are used to build the fulltext index. Remember that '+' is a boolean operator also, and that increasing the indexed character set will increase the index size and lower performance.
|
# ¿ Apr 14, 2008 13:49 |
|
|
# ¿ May 7, 2024 10:49 |
|
minato posted:If adding an index is slowing a SELECT down, then I would guess that the query planner is stupidly using the index when a sequential search would be better (which is the case when the number of rows in the table is low). Not much you can do about that. Many databases allow for index hints of some kind. MySQL has "USE/IGNORE/FORCE INDEX". Oracle has "SELECT /*+ ... */". I think MSSQL has WITH(INDEX()) or something like that. Last I checked, Postgres does not have hints, because the developers don't like the concept (which I agree with mostly, but I've had lots of instances with MySQL where hints were a must).
|
# ¿ Apr 15, 2008 16:04 |