Sample Header Ad - 728x90

Database Administrators

Q&A for database professionals who wish to improve their database skills

Latest Questions

0 votes
0 answers
57 views
MySQL: Using Symbolic Links for Databases on linux
Someone gave me a database. It's (1) a folder containing files with the following extensions: `MYD`, `MYI`, `TRG`, `TRN`, `frm`, `opt`; (2) a file with the sql-extension called `db_add_nodata.sql` , and (3) a file called `sphinx.conf` I have generated my database using the file with the sql-extensio...
Someone gave me a database. It's (1) a folder containing files with the following extensions: MYD, MYI, TRG, TRN, frm, opt; (2) a file with the sql-extension called db_add_nodata.sql , and (3) a file called sphinx.conf I have generated my database using the file with the sql-extension (am not sure what you call it, perhaps this file is called the sqldump?) in the following way: mysql -u root -p < db_add_nodata.sql Internally, it executes CREATE DATABASE 'technical1';. And I find the folder technical1 in my data dir /var/lib/mysql/technical1. I used the most recent version of the official documentation on the mysql website to try to create a soft link to the data which is on an external hard drive and mounted at such that the data are in /media/user/drive/data: $ mv technical1 /media/user/drive/ $ mv /media/user/drive/data/* /media/user/drive/technical1 $ ln -s /media/user/drive/technical1 /var/lib/mysql $ ls -lah technical1 drwx------ 2 mysql mysql 4.0K Jan 16 13:58 technical1 **Questions** - If I now execute the sql-statement SHOW DATABASES, the database technical1 is no longer showing up. Why's that? - Do the other steps look reasonable and correct, or can you see something else which looks odd?
Mikke Mus (101 rep)
Jan 16, 2025, 05:11 PM • Last activity: Jan 16, 2025, 08:57 PM
0 votes
1 answers
37 views
List sorted Posts on Group and children Groups efficiently
Say I have a system that has Groups and Posts on those Groups. A Group can have multiple "child Groups" > Group 1 > Group 2 > Group 3 > Group 1 > Group 2 > Group 4 > Group 1 > Group 5 > Group 6 > ... So I have these two tables: `Groups (*GroupId*, Name, ParentGroupId, ...)` `Posts (*PostId*, GroupId...
Say I have a system that has Groups and Posts on those Groups. A Group can have multiple "child Groups" > Group 1 > Group 2 > Group 3 > Group 1 > Group 2 > Group 4 > Group 1 > Group 5 > Group 6 > ... So I have these two tables: Groups (*GroupId*, Name, ParentGroupId, ...) Posts (*PostId*, GroupId, UserId, Text, ...) Displaying a list of latest 10 posts on Group 3, 4 and 6 isn't a problem. An index on GroupId does it (WHERE GroupId=12345 ORDER BY PostId DESC). However, the challenge I'm having is how can I make Group 2 list posts created directly in Group 2, but also on children (Group 3 and 4), and the same for Group 1 (list posts on Group 1 and on all children, sorted). The only thing I can think of is to create an extra "indexing table" which will have a list of PostId for each Parent Group, and use that to retrieve the Posts. But, I'm afraid that will be a pain to maintain and ensure it's accurate (like using a TRIGGER). What if a bug happens and then we have to fix the index, rebuild the whole index again, etc... Is there a better way of doing this? I was hoping to use something more native and auto-maintained. I use MariaDB 10.4 and Sphinx Search.
Nuno (829 rep)
Jun 28, 2021, 11:39 PM • Last activity: Dec 11, 2021, 03:05 PM
0 votes
1 answers
205 views
How to select more than 20 rows in SPHINX engine?
I use [SphinxSE][1] instead of `FULLTEXT`. Sphinx settings are for end-users of a search engine. According to the official [documentation][2], > LIMIT clause. Both LIMIT N and LIMIT M,N forms are supported. Unlike > in regular SQL (but like in Sphinx API), an implicit LIMIT 0,20 is > present by defa...
I use SphinxSE instead of FULLTEXT. Sphinx settings are for end-users of a search engine. According to the official documentation , > LIMIT clause. Both LIMIT N and LIMIT M,N forms are supported. Unlike > in regular SQL (but like in Sphinx API), an implicit LIMIT 0,20 is > present by default. Therefore, any query returns only 20 rows MariaDB [sphinx]> SELECT * FROM t1 WHERE query='test;mode=any'; +------+--------+---------------+ | id | weight | query | +------+--------+---------------+ | 556 | 1 | test;mode=any | | 864 | 1 | test;mode=any | | 1329 | 1 | test;mode=any | | 1781 | 1 | test;mode=any | | 1832 | 1 | test;mode=any | | 2157 | 1 | test;mode=any | | 2388 | 1 | test;mode=any | | 2889 | 1 | test;mode=any | | 3118 | 1 | test;mode=any | | 3155 | 1 | test;mode=any | | 3255 | 1 | test;mode=any | | 3485 | 1 | test;mode=any | | 3495 | 1 | test;mode=any | | 3623 | 1 | test;mode=any | | 4034 | 1 | test;mode=any | | 4525 | 1 | test;mode=any | | 4563 | 1 | test;mode=any | | 4659 | 1 | test;mode=any | | 4736 | 1 | test;mode=any | | 4807 | 1 | test;mode=any | +------+--------+---------------+ 20 rows in set (0.027 sec) I experimented with various settings in the sphinx.conf, but am unable to change the setting to return more results in a SQL query.
Googlebot (4551 rep)
Apr 13, 2021, 11:46 AM • Last activity: Apr 15, 2021, 09:49 PM
1 votes
1 answers
282 views
How to add sphinx engine to mysql 5.7?
On my Ubuntu 18.04 machine using ` mysql 5.7` I have installed sphinxsearch 2.2 and now I'd like to add SphinxSE as an engine so that I can connect to it without language-specific medium. The docs on [sphinix][1] is rather old (for `MySQL 5.1.x`) and involves compiling mysql from source which I shy...
On my Ubuntu 18.04 machine using mysql 5.7 I have installed sphinxsearch 2.2 and now I'd like to add SphinxSE as an engine so that I can connect to it without language-specific medium. The docs on sphinix is rather old (for MySQL 5.1.x) and involves compiling mysql from source which I shy away from as it may break the existing stuff. So I'm wondering if there is any straightforward solution for this which does not require source compilation?
Karlom (165 rep)
Mar 11, 2021, 06:49 AM • Last activity: Mar 11, 2021, 10:14 PM
Showing page 1 of 4 total questions