How do we delete caches?

classic Classic list List threaded Threaded
3 messages Options
devinbost devinbost
Reply | Threaded
Open this post in threaded view
|

How do we delete caches?

When we create a new table via SQL, it creates the cache for the table (as
expected). However, if we drop the table, the cache is not deleted. We can't
figure out how to delete the cache. So, we have many caches accumulating
that we can't delete but can't use for SQL because we've deleted their
tables.

How do we delete caches?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
devinbost devinbost
Reply | Threaded
Open this post in threaded view
|

Re: How do we delete caches?

devinbost wrote

> When we create a new table via SQL, it creates the cache for the table (as
> expected). However, if we drop the table, the cache is not deleted. We
> can't
> figure out how to delete the cache. So, we have many caches accumulating
> that we can't delete but can't use for SQL because we've deleted their
> tables.
>
> How do we delete caches?
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/

For example, to run a SQL script to create a table, we can run:
    clientCache = ignite.getOrCreateCache(tableName);
   
clientCache.query(IgniteHelpers.createFieldsQuery("sql/createExampleTable.sql")).getAll();

Is there a way to run the SQL query that doesn't require us to first get or
create an existing cache? If we run the two lines above, it takes the cache
name and uses it for the Table's schema name and then creates another cache
in the form of SQL_<CACHE_NAME>_<TABLE_NAME>, which results in two caches,
only one of which is deleted when we drop the table.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Alexandr Shapkin Alexandr Shapkin
Reply | Threaded
Open this post in threaded view
|

RE: Re: How do we delete caches?

> How do we delete caches?

 

What about DROP TABLE [1]? This should remove both a table and a cache.

 

> Is there a way to run the SQL query that doesn't require us to first get or

create an existing cache

 

You can use a thin client for that, please, review the JDBC example.

With this approach, the default schema would be PUBLIC.

 

> which results in two caches, only one of which is deleted when we drop the table.

Ignite allows you to use a single cache for multiple tables, but we do not recommend this approach.

 

You can set your schema manually using cache API with SqlQuery.setSchema("PUBLIC")  [2]

 

[1] - https://apacheignite-sql.readme.io/docs/drop-table

[2] - https://apacheignite-sql.readme.io/docs/schema-and-indexes#section-overview

 

 

From: [hidden email]
Sent: Friday, November 15, 2019 2:55 AM
To: [hidden email]
Subject: Re: How do we delete caches?

 

devinbost wrote

> When we create a new table via SQL, it creates the cache for the table (as

> expected). However, if we drop the table, the cache is not deleted. We

> can't

> figure out how to delete the cache. So, we have many caches accumulating

> that we can't delete but can't use for SQL because we've deleted their

> tables.

>

> How do we delete caches?

>

> --

> Sent from: http://apache-ignite-users.70518.x6.nabble.com/

 

For example, to run a SQL script to create a table, we can run:

    clientCache = ignite.getOrCreateCache(tableName);

  

clientCache.query(IgniteHelpers.createFieldsQuery("sql/createExampleTable.sql")).getAll();

 

Is there a way to run the SQL query that doesn't require us to first get or

create an existing cache? If we run the two lines above, it takes the cache

name and uses it for the Table's schema name and then creates another cache

in the form of SQL_<CACHE_NAME>_<TABLE_NAME>, which results in two caches,

only one of which is deleted when we drop the table.

 

 

 

--

Sent from: http://apache-ignite-users.70518.x6.nabble.com/

 

Alex Shapkin