# Why is ODBC.jl extremely slow using snowflake driver

**URL:** <https://discourse.julialang.org/t/why-is-odbc-jl-extremely-slow-using-snowflake-driver/85354>\
**Category:** Data\
**Tags:** question\
**Created:** [August 5, 2022, 4:29pm UTC](https://discourse.julialang.org/t/why-is-odbc-jl-extremely-slow-using-snowflake-driver/85354 "2022-08-05T16:29:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Impressium](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/impressium/32/19575_2.png) [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Post date:** [August 5, 2022, 4:29pm UTC](https://discourse.julialang.org/t/why-is-odbc-jl-extremely-slow-using-snowflake-driver/85354/1 "2022-08-05T16:29:09Z")

</div>

Hi all 🙂

I’m using ODBC.jl with snowflake. I ran into a problem though while using the `replace` function in the query string.

For example:  
1.)

```julia
SELECT
    replace(col_name, '.', ' ') as col_name
FROM
    db.tb

```

is very very slow. But  
2.)

```julia
SELECT
    col_name
FROM
    db.tb

```

runs normal.

I don’t understand why that is. I tried the first string within python (`pyodbc`, same driver and db) and it was fast/normal.

Can anybody reproduce this or give me any advice what to test next?

Cheers Lars

---

<div class="post-metadata">

**Author:** ![drizk1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drizk1/32/208422_2.png) [@drizk1](https://discourse.julialang.org/u/drizk1)\
**Post date:** [June 20, 2024, 3:36pm UTC](https://discourse.julialang.org/t/why-is-odbc-jl-extremely-slow-using-snowflake-driver/85354/2 "2024-06-20T15:36:55Z")

</div>

I am not sure if this is faster as I have not used Snowflake via ODBC, but you can now query and connect to snowflake via the Snowflake SQL Rest API with TidierDB.jl v.1.9  
Here is further [documentation](https://tidierorg.github.io/TidierDB.jl/latest/examples/generated/UserGuide/Snowflake/)

```julia
ac_id = "string_id"
token = "OAuth_token_string"
con = connect(:snowflake, ac_id, token, "DEMODB", "PUBLIC", "COMPUTE_WH")
# After connection is established, a you may begin querying.
stable_table_metadata = db_table(con, "MTCARS")

julia> @chain begin
           from_query(stable_table)
           @mutate(COLUMN1 = str_remove(COLUMN1, "M"))
           @show_query
           #@collect
       end
WITH cte_2 AS (
SELECT REGEXP_REPLACE(COLUMN1, "M", "") AS COLUMN1, MPG, CYL, DISP, HP, DRAT, WT, QSEC, VS, AM, GEAR, CARB
        FROM DEMODB.PUBLIC.MTCARS)  
SELECT *
        FROM cte_2

```
