Commit Graph

21 Commits

Author SHA1 Message Date
Martin Kleusberg
a6d48f1ae4 Simplify interface and implementation of SqliteTableModel
This simplifies the usage and the implementation of the SqliteTableModel
a bit by making the two operating modes it supports (manual query and
interactive query) more obvious in its public interface as well as
simplifying the control flow in the private implementation.
2021-01-25 18:13:49 +01:00
Martin Kleusberg
36048d57f3 Rework 89587a7d67
This partially reverts 89587a7d67 to fix
some issues it introduced. Using the knowledge we gained in the further
optimisation process, this commit now gets us the best of both worlds:
good performance when executing complex queries as well as a more
straightforward way to deal with the multithreaded nature of data
loading.

See issue #2537.
2021-01-19 23:10:09 +01:00
Martin Kleusberg
6f4990544b Fix remaining issue with optimised SELECT statements
This fixes a remaining issue which was introduced in the series of
commits made for improving the performance of running SELECT statements
in the Execute SQL tab. The problem here was that rerunning a query did
not show any results in the view.

See issue #2165.
2021-01-11 18:23:08 +01:00
Martin Kleusberg
b41046e6b6 Further speed up loading of data from SQL queries
This further improves the performance of SELECT statements by not
triggering the row count determiniation if it is not needed. So for
queries which return less rows than the configured prefetch block size
we save an extra query. Because this requires querying the data first
and the row count second (before this the order was reversed) the data
also appears faster in the UI.

This commit also fixes another issue which was introduced in commit
89587a7d67: When setting a filter which
made the query not return any data, the column names and the filter row
became invisible. Because of that it was also impossible to change the
filter again.
2021-01-09 14:28:44 +01:00
Martin Kleusberg
cc44c974cd Fix 89587a7d67
This fixes some issues with table browsing which were introduced in
commit 89587a7d67.
2021-01-09 11:49:01 +01:00
Martin Kleusberg
89587a7d67 Speed up executing SQL queries
This improves the performance of running SQL queries in the
SqliteTableModel class by avoiding an extra query for figuring out the
column names and data types of the returned data.

See issue #2165.
2020-12-29 21:10:19 +01:00
Martin Kleusberg
b9b67cce70 Disable lazy popululation for queries with compound operators
This disables the lazy population feature for queries in the Execute SQL
tab which contain a compound operator (UNION, EXCEPT, INTERSECT). Adding
a LIMIT clause to the statements (as needed for lazy population) results
in a syntax error, so running these queries does not show any data.

See issue #2316.
2020-07-01 13:11:45 +02:00
Martin Kleusberg
ba1270cedb Clean up the code and make some more minor optimisations
This also includes replacing some more Qt containers by their STL
counterparts.
2019-11-06 20:25:18 +01:00
Martin Kleusberg
4e8eff7af0 Some more minor performance improvements in often called functions 2019-10-07 18:23:43 +02:00
Martin Kleusberg
9594115ef3 Send the fetched signal in RowLoader even when no rows where fetched
Always send the fetched() signal when a RowLoader thread has finished a
fetch task. Before this the signal was only sent when some data was
actually retrieved from the task. This fixes some rare problems in the
Execute SQL tab where the query for determining the row count of a
SELECT statement changes something, so the subsequent row loading task
does not return any rows after all.

The only case I know of is when loading an extension using the
'SELECT load_extension()' function. The load_extension function is
actually called twice when SQLite for some reason reports that rows
where returned from this statement. These calls are:
SELECT COUNT(*) FROM (SELECT load_extension('...'));
SELECT load_extension('...');
After the first call is executed, the extension is loaded. So the second
call does not return any rows and we indefinitely wait for the rows we
expect. Strangely enough this only happens for some extensions.

The change here should have no side effects becaue the signal is only
connected to one slot which skips most steps when no rows where fetched.

See issue #1932.
2019-07-06 23:05:57 +02:00
Martin Kleusberg
9c0b36d7b7 Speed up the loading of row data a bit
This improves the performance for loading row data with my setup by
about 10%. Incidentally, the conversion from Qt to STL containers
reduced the performance by about the same number.
2019-05-02 12:34:14 +02:00
Martin Kleusberg
e16537dd9a Use emplace_back some more 2019-05-02 12:05:27 +02:00
Martin Kleusberg
f821fbb1a8 Silence a couple of warnings 2019-04-29 19:14:10 +02:00
Martin Kleusberg
15c23bb0d3 Use some more SQL containers instead of their Qt equivalents 2019-04-29 18:11:19 +02:00
Martin Kleusberg
f59a2453a2 Fix some warning and other code style changes 2019-04-26 14:48:24 +02:00
Martin Kleusberg
45a82252e1 Fix possible resource leaks
See issue #1691.
2018-12-27 11:55:21 +01:00
mgrojo
cfdf68d562 Use a specialised count query for browsing tables/views
For queries built from a table and filters, use a specialised count query
that only takes into account the where part of the statement. This will
speed-up the Browse Data tab for big tables.

See issue #1666
2018-12-20 10:49:22 +01:00
Martin Kleusberg
c91009c7f3 Fix old-style-cast warnings 2018-11-15 15:11:09 +01:00
Martin Kleusberg
2dd1dce09f Use nullptr some more 2018-09-28 18:58:22 +02:00
Martin Kleusberg
3da520cdd1 Clean up multi threading patch, fix build and some bugs
Make strings translatable, remove some more debug code, fix tests,
reduce size of patch slightly, remove weird tooltip, don't crash when
closing database, simplify code, fix filters, don't link agains pthread
on Windows.
2018-06-08 22:46:47 +02:00
Martin Kleusberg
51dbe72e23 Multi-threading patch
This was done by Michael Krause.
https://lists.sqlitebrowser.org/pipermail/db4s-dev/2018-February/000305.html

In this commit I only fixed two compiler warnings, some whitespace
issues and removed some debug messages.
2018-06-08 22:46:47 +02:00