Select big data with RODBC from SQL Server is slow - rodbc

I use sqlQuery in RODBC to select data from a SQL Server database, the data is about 2000000 rows and 130 columns, and it takes more than 30 minutes. However in SQL Server Management Studio, it only needs 2 minutes.
How can I speed up the data select or should I use other packages but not RODBC?

Related

SQLite SELECT queries are slowing down after bulk INSERT

I have 2 connections open to an SQLite database. On one connection a task is running simple SELECT queries on a single table using only the PK in the WHERE clause. This query is prepared once and repeatedly executed. On the other connection, INSERT queries are run periodically on the same table, about 2000 inserts per run.
What I observed is that the SELECT queries are fast (<1ms) but after the second connection has executed the INSERTs, then the SELECT queries slow down to ~20ms.
When I restart the application, using the same database file, then the SELECT queries are fast again.
This only happens on Windows (MSVC 2019, vc142), on Linux (GCC 11) the INSERTs have no effect on the SELECTs.
What could cause this slowdown and is there a workaround?
Extra info:
Each connection runs the following statements right after connection.
PRAGMA synchronous = NORMAL;
PRAGMA journal_mode = WAL;
PRAGMA busy_timeout = 1000;
Versions of SQLite used: 3.36.0 (Windows), 3.37.2 (Linux)

EXPDP Running too slow

we have a database with size 16GB.We are running daily backup using EXPDP,but few days ago this EXPDP taking too long to complete(more than 6 hours).
my question is
1) does TABLE LOCKS affect performance of EXPDP(i have checked for table locking and found a number tables were on lock(we are updating tables using some procedures which are set to run multiple times for a day)..
2) will hard disk related issue slow down EXPDP performance??
As per your suggestion i have included the query(While the expdp is Running)
select elapsed_time/1000000 seconds,sql_text,SHARABLE_MEM,PERSISTENT_MEM,RUNTIME_MEM,USERS_EXECUTING,DISK_READS,BUFFER_GETS,USER_IO_WAIT_TIME from gv$sql where users_executing > 0 order by elapsed_time desc;
For this query i am getting more than 20 records and i will share some records
enter image description here

Why does Vertica query_requests table report that a query took a few milliseconds, while it actually took 10 seconds?

I'm running queries against a Vertica table with close to 500 columns and only 100 000 rows.
A simple query (like select avg(col1) from mytable) takes 10 seconds, as reported by the Vertica vsql client with the \timing command.
But when checking column query_requests.request_duration_ms for this query, there's no mention of the 10 seconds, it reports less than 100 milliseconds.
The query_requests.start_timestamp column indicates that the beginning of the processing started 10 seconds after I actually executed the command.
The resource_acquisitions table show no delay in resource acquisition, but its queue_entry_timestamp column also shows the queue entry occurred 10 seconds after I actually executed the command.
The same query run on the same data but on a table with only one column returns immediately. And since I'm running the queries directly on a Vertica node, I'm excluding any network latency issue.
It feels like Vertica is doing something before executing the query. This is taking most of the time, and is related to the number of columns of the table. Any idea what it could be, and what I could try to fix it ?
I'm using Vertica 8, in a test environment with no load.
I was running Vertica 8.1.0-1, it seems the issue was caused by a Vertica bug in the query planning phase causing a performance degradation. It was solved in versions >= 8.1.1 :
https://my.vertica.com/docs/ReleaseNotes/8.1./Vertica_8.1.x_Release_Notes.htm
VER-53602 - Optimizer - This fix improves complex query performance during the query planning phase.

Query time of ms access on network

A ms access 2000 mdb file is hosted on a network drive. Inside this mdb, tbl_History table has 42,223 records. Every month, new 2,400 records are stored on this table.
A customized application developed by VS 2005 is queried on this table. The query is like this -
SELECT Top 1 MEMonth, MEYear FROM tbl_History WHERE SnapDate IN (SELECT MAX(SnapDate) FROM tbl_History WHERE CompanyCode = 'ABC'
To get the query result, it takes a minute. Is there any way to fine-tune the query time?
Thank you.

Tuning the below Sql query

I have a database of Old version Oracle 8.1.7 there I have been running the below Union query
select c_ordine_es
,c_ordine_salesnet
,v_oyov
,v_annuale
,v_oneoff
,v_canone
,c_operatore_tam
from v_ordine_cliente_easysell
where d_ultima_modifica>DataRif
union
select c_ordine_es
,c_ordine_salesnet
,v_oyov
,v_annuale
,v_oneoff
,v_canone
,c_operatore_tam
from v_ordine_cliente_easysell v
,scarti_interfaccia_easysell_o s
where s.c_codice_es=v.c_ordine_es
and s.t_tabella_es=pkType.K_SCARTO_ORDINE_CLIENTE;
Every time I run these query the SQL Client(I am using Toad) hangs. Here I must mention data in v_ordine_cliente_easysell and scarti_interfaccia_easysell_o these two views/synonyms are fetched using DB Link(To another SIEBEL DB). I guess the problem is happening at the time of fetching data via DB_LINK, as the SIEBEL DB is alwas very busy. Would you please suggest me how could I tune the above query?
The Explain plan goes like below
OPERATION OPTIONS OBJECT_NODE POSITION COST CARDINALITY BYTES
SELECT STATEMENT 28 28 478912 61779648
HASH JOIN 1 28 478912 61779648
INDEX FAST FULL SCAN 1 2 11354 102186
REMOTE SIEB.WORLD 2 23 4218 506160
Make a local copy of table v_ordine_cliente_easysell.
Make a local copy of table scarti_interfaccia_easysell_o filtered with
t_tabella_es=pkType.K_SCARTO_ORDINE_CLIENTE.
Run the query on local copies, but using UNION ALL

Resources